zoukankan      html  css  js  c++  java
  • jquery导航滚动固定在顶部

    function dhDiv(ee1){
            //导航距离屏幕顶部距离 
            var _defautlTop = $("#"+ee1).offset().top - $(window).scrollTop(); 
            //导航距离屏幕左侧距离 
            var _defautlLeft = $("#"+ee1).offset().left - $(window).scrollLeft(); 
            //导航默认样式记录,还原初始样式时候需要 
            var _position = $("#"+ee1).css('position'); 
            var _top = $("#"+ee1).css('top'); 
            var _left = $("#"+ee1).css('left'); 
            var _zIndex = $("#"+ee1).css('z-index'); 
            //鼠标滚动事件 
            $(window).scroll(function(){ 
                if($(this).scrollTop() > _defautlTop){ 
                    //IE6不认识position:fixed,单独用position:absolute模拟 
                    if($.browser.msie && $.browser.version=="6.0"){                     
                        $("#"+ee1).css({'position':'absolute','top':eval(document.documentElement.scrollTop),'left':_defautlLeft,'z-index':99999});                     
                        //防止出现抖动 
                        $("html,body").css({'background-image':'url(about:blank)','background-attachment':'fixed'}); 
                    }else{ 
                        $("#"+ee1).css({'position':'fixed','top':0,'left':_defautlLeft,'z-index':99999}); 
                    } 
                }else{ 
                    $("#"+ee1).css({'position':_position,'top':_top,'left':_left,'z-index':_zIndex}); 
                } 
            }); 
        }
  • 相关阅读:
    Linux的基础优化
    Linux日志文件/var/log详解
    Linux下inittab文件详解
    Linux内核优化
    Linux虚拟机网络连接的三种方式
    Linux下ssh的使用
    nginx安装Lets Encrypt SSL免费HTTPS加密证书
    centos7.2 安装 nginx
    CentOS 7 安装php7
    linux tar 解压出错
  • 原文地址:https://www.cnblogs.com/daixingqing/p/2768378.html
Copyright © 2011-2022 走看看