jquery导航条滑动|jquery导航条悬浮停止(浏览器窗口)页面顶部 兼容ie6

时间:2018-05-08  来源:jquery  阅读:

css代码

 代码如下

.nav_scroll{ position:fixed;top:0;left:0;z-index:1200; width:100%;}


js代码

 代码如下

<script type="text/javascript">
$(function(){

if ($.browser.msie && ($.browser.version == "6.0") && !$.support.style) {
var handler,sTop,dTop;
    dTop = $("#fixedNav").offset().top
    $(window).bind("scroll",function(){
        window.clearTimeout(handler);
        handler = window.setTimeout(function(){
            sTop = $(document).scrollTop();
            sTop > dTop ? $("#fixedNav").css("top",sTop - dTop) : $("#fixedNav").css("top",0);
     $("#fixedNav").css({"position":"relative","z-index":"1200"});
        },60);
    });
}else{

 var topMain= $("#fixedNav").offset().top
 $(window).scroll(function(){
  if ($(window).scrollTop()>topMain){
   $("#fixedNav").addClass("nav_scroll");
  }else{
   $("#fixedNav").removeClass("nav_scroll");
  }
 });

 }
});
</script>

html

 代码如下

id=fixedNav>


 
     
        首页 |      
        服务器 |
        编程 |
        seo/seo.html">搜索&seo |
        网站运营 |
        ps教程 |
        数据库 |
        网页布局 |
        js特效 |  
        网页制作 |   
        flash_a/flash.html">动画设计 |
       网页模板 |
       建站源码
           
  

jquery导航条滑动|jquery导航条悬浮停止(浏览器窗口)页面顶部 兼容ie6

http://m.bbyears.com/wangyezhizuo/41251.html

推荐访问:
相关阅读 猜你喜欢
本类排行 本类最新