你好吗?
当我向下滚动页面时,我使用粘性元素的路径点插件。
不过,我希望在页面的某个位置删除粘性元素,比如说距离起始滚动点 30px,然后当用户向上滚动页面时,粘性元素将其带回到其原始起点:
JavaScript:
$(function() {
// Do our DOM lookups beforehand
var nav_container = $(".nav-container");
var nav = $("nav");
nav_container.waypoint({
handler: function(event, direction) {
nav.toggleClass('sticky', direction=='down');
if (direction == 'down') nav_container.css({ 'height':nav.outerHeight() });
else nav_container.css({ 'height':'auto' });
},
offset: 15
});
});
你可以看看我在网上找到的另一个例子在这里http://webdesigntutsplus.s3.amazonaws.com/tuts/313_waypoints/demo/index.html http://webdesigntutsplus.s3.amazonaws.com/tuts/313_waypoints/demo/index.html
可以说,我希望粘性导航在我向下滚动时在第一章处掉落,然后当我向上滚动时,它会被拾起并将其带到起点。
Also: http://imakewebthings.com/jquery-waypoints/#doc-disable http://imakewebthings.com/jquery-waypoints/#doc-disable我试图使用这个但没有成功。
谢谢
Fiddle 的任何指示都会有帮助!
None
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)