我试图在向下滚动事件中隐藏#header,然后在页面向上滚动中重新出现。
页面链接:- http://elementsmart.com/product-category/jewellery/
我使用的javascript代码
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript">
$('#primary').scroll(function(){
if($(this).scrollTop() > 300) $('#header').fadeOut('slow');
if($(this).scrollTop() < 300) $('#header').fadeIn('slow');
});
</script>CSS
#header-container {
position:fixed !important;
margin-left:1.6% !important;
z-index:999 !important;
}当有人滚动时,主要需要隐藏标题。
在jsfiddle上试用似乎工作得很完美,但在页面上它现在显示出来。
有人能给我带路吗?
发布于 2013-06-28 15:50:44
快完成了,更改
$('#primary').scroll(function(){至
$(window).scroll(function(){还可以用
$(function(){
//your code here
});https://stackoverflow.com/questions/17359599
复制相似问题