我现在在一个带有粘性标题的网站上工作。我遇到的问题是它不是很粘。它跳了很多,不会粘回原位。有想法该怎么解决这个吗?您可以在 dupontstudios.com 上看到它。这是一段代码。谢谢!
<script language="javascript" type="text/javascript">
$(function() {
// Do our DOM lookups beforehand
var nav_container = $(".nav-container");
var nav = $("nav");
nav_container.waypoint({
handler: function(direction) {
nav_container.toggleClass('sticky', direction=='down');
}
});
<div id = 'top-container'>
<video id = 'top-vid' autoplay loop width=100% height = 'auto' class = 'no-mobile' ><source src = 'DS_Intro.mov' type = 'video/mp4'><source src = 'test.webm' type = 'video/webm'></video>
<div id = 'top-content'>
<div id = 'top-text'>
<div id = 'top-img'>
<img src='ds_white.png' width = "100%" height = 'auto'>
</div>
<h1 id = 'top-slogan'>a boutique video production studio</h1>
</div>
</div>
</div>
<div class = 'nav-container'>
<nav>
<div id = 'nav-items-container'>
<ul class='nav-items'>
<li class='nav-item'><a href='#what'>what</a></li>
<li class='nav-item'><a href='#how'>how</a></li>
<li class='nav-item'><a href='#why'>why</a></li>
<li class='nav-item'><a href='#where'>where</a></li>
<li class='nav-item'><a href='#who'>who</a></li>
</ul>
</div>
</nav>
</div>