jquery单页网站导航插件One Page Nav

这是一个轻量级的jQuery的单页网站导航插件。增加了单击后平滑滚动导航和当你浏览不同的部分时自动选择正确的导航项。

changeHash: false, 改变当用户单击导航,就改变changeHash选项为true。

scrollSpeed: 750,

scrollThreshold: 0.5,

filter: '',

easing: 'swing',

begin: function() { //I get fired when the animation is starting },

end: function() { //I get fired when the animation is ending },

scrollChange: function($currentListItem) { //I get fired when you enter a section and I pass the list item of the section } });



在项目中选择一个导航→传入一个选择器过滤选项。


选择到该导航,调用onePageNav();
$('#nav').onePageNav(
filter: ':not(.external)'
});

如果你在iOS设备上单击链接导航导致 其他链接断掉,你可以通过滚动操作来解决这个问题

$('#nav').onePageNav({
begin: function() {
//Hack so you can click other menu items after the initial click
$('body').append('<div id="device-dummy" style="height: 1px;"></div>');
},end: function() {
$('#device-dummy').remove();
}
});

原文地址:https://www.cnblogs.com/lcf1314/p/5677586.html