顶部固定导航,,向上滚动的时候显示,,向下滚动的时候隐藏。类似新浪详细页效果...
<script type="text/javascript">
var Top = 92;
$(window).scroll(function(){
var t = $(window).scrollTop();
if(!($.browser.msie && $.browser.version == "6.0")){
if(t<Top){
Top = t ;
$("#topNav").css('position','fixed');
}else{
Top = t;
$("#topNav").css('position','static');
}
}
});
</script>
<body>
<div class="topNav" id="topNav" style="height:35px; background:#f00; top:0; left:0; 100%;"></div>
<div class="main" style="1000px; height:2000px; background:#000; margin:0 auto;">
1111
</div>