码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2016-07-17 13:04:24      阅读:218      评论:0      收藏:0      [点我收藏+]

标签:

这是一个轻量级的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();
}
});

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

标签:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!