简体   繁体   English

jquery sticky-nav-bar 表现得像一个 css3 动画,如何阻止它?

[英]jquery sticky-nav-bar behaving like a css3 animation, how to stop it?

live website is on this address: www.calimousineservice.com Hi i am making this simple website and the i tried to include a sticky nav on top.实时网站位于以下地址:www.calimousineservice.com 嗨,我正在制作这个简单的网站,我试图在顶部包含一个粘性导航。 everything works as expected so far the only problem is that when i scroll the Jquery acts like a slide-in-animation rather than just sticking to the top of the window right away.到目前为止,一切都按预期工作,唯一的问题是,当我滚动 Jquery 时,它就像一个幻灯片动画,而不是立即粘在窗口的顶部。 also since i attached this my image slider has some kind of lagging when sliding the images.也因为我附上了这个,我的图像滑块在滑动图像时有某种滞后。 i have all my script and file.js(s) attached at the bottom of the html and here are my javascript for sticky nav in addition to its uploaded js files:我的所有脚本和 file.js(s) 都附加在 html 的底部,除了上传的 js 文件之外,这里还有我用于粘性导航的 javascript:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="js/jquery.cycle2.min.js"></script>

<script>
    function makeSticky() {
        var myWindow = $(window), 
        myHeader = $(".navigation");

        myWindow.scroll(function() {
            if (myWindow.scrollTop() == 0 ) {
                myHeader.removeClass("sticky-nav");
            } else {
                myHeader.addClass("sticky-nav");
            }
        });
    }
    $( function() {
        makeSticky(); 
    });
</script>

there is another script that will pop up a image on the right of the nav bar when scrolled down:还有另一个脚本会在向下滚动时在导航栏的右侧弹出一个图像:

<script>
    function hideImg() {
        var myWindow = $(window),
        container= $(".nhide");

        myWindow.scroll(function() {
            if (myWindow.scrollTop() == 0 ) {
                container.addClass("nhide");
            } else{
                container.removeClass("nhide");
            }   
        });  
    }

    $( function() {
        hideImg(); 
    });
</script>

please scroll down and up few times to get the glimpse of what i am talking about here.请向下和向上滚动几次以了解我在这里谈论的内容。 the nav bar, when scrolled, acts like a slide-in-animation(like a css3 animation) i want to remove that.导航栏在滚动时就像一个幻灯片动画(如 css3 动画),我想删除它。 and also the problem with my slider.还有我的滑块的问题。 thank you in advance please let me know if i need to provide more of the codes.预先感谢您,如果我需要提供更多代码,请告诉我。

It's fell under the slideshow.它属于幻灯片。 To fix it, give your navbar z-index property with value more than the slideshow's z-index.要修复它,请为您的导航栏 z-index 属性设置比幻灯片的 z-index 更大的值。

I guess that z-index:999 can fix it!我猜z-index:999可以解决它!

UPDATE:更新:

Set your navbar's transition property to 0 .将导航栏的transition属性设置为0 Because there seem that there are global selector that is used to set the transition.因为似乎有用于设置过渡的全局选择器。

Make sure that you are using the most specific selector to prevent other element's rules ruling your navbar.确保您使用的是最具体的选择器,以防止其他元素的规则支配您的导航栏。

Example:例子:

#yournavbar_container .navbar {
  transition: 0s;
}

Or set all values to default:或将所有值设置为默认值:

#yournavbar_container .navbar {
  transition: all 0s ease 0s;
}

You can also use this:你也可以使用这个:

#yournavbar_container .navbar {
  transition:none;
  transition-delay:0s;
  transition-duration:0s;
  transition-property:none;
  transition-timing-function:ease;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM