Javascript 过渡点导航

Javascript 过渡点导航,javascript,jquery,css,Javascript,Jquery,Css,如何使用右侧的竖条和圆点(圆圈)创建粘性导航栏: 我的HTML: //Jquery导航 /* *jQuery单页导航插件 * http://github.com/davist11/jQuery-One-Page-Nav * *版权所有(c)2010特雷弗·戴维斯(http://trevordavis.net) *MIT和GPL许可下的双重许可。 *使用与jQuery相同的许可证,请参阅: * http://jquery.org/license * *@version 3.0.0 * *用法示

如何使用右侧的竖条和圆点(圆圈)创建粘性导航栏:

我的HTML:

//Jquery导航
/*
*jQuery单页导航插件
* http://github.com/davist11/jQuery-One-Page-Nav
*
*版权所有(c)2010特雷弗·戴维斯(http://trevordavis.net)
*MIT和GPL许可下的双重许可。
*使用与jQuery相同的许可证,请参阅:
* http://jquery.org/license
*
*@version 3.0.0
*
*用法示例:
*$('#nav')。onePageNav({
*currentClass:'当前',
*changeHash:false,
*滚动速度:750
* });
*/
;(函数($,窗口,文档,未定义){
//我们的插件构造函数
var OnePageNav=功能(元素、选项){
this.elem=elem;
这个.$elem=$(elem);
this.options=选项;
this.metadata=this.$elem.data('plugin-options');
此.$win=$(窗口);
this.sections={};
this.didcoll=false;
此.$doc=$(文档);
this.docHeight=此.$doc.height();
};
//插件原型
OnePageNav.prototype={
默认值:{
navItems:“a”,
currentClass:'当前',
changeHash:false,
放松:"摇摆",,
筛选器:“”,
滚动速度:750,
滚动阈值:0.5,
开始:错,
完:错,,
滚动更改:false
},
init:function(){
//引入可以扩展的默认值
//全局或使用对象文字。
this.config=$.extend({},this.defaults,this.options,this.metadata);
this.$nav=this.$elem.find(this.config.navItems);
//过滤掉导航中的任何链接
如果(this.config.filter!=''){
this.$nav=this.$nav.filter(this.config.filter);
}
//导航上的手柄咔嗒声
this.nav.on('click.onePageNav',$.proxy(this.handleClick,this));
//获取截面位置
这个.getPositions();
//处理滚动更改
这个.bindInterval();
//也要更新调整大小时的位置
this.win.on('resize.onePageNav',$.proxy(this.getPositions,this));
归还这个;
},
adjustNav:功能(自身$parent){
self.$elem.find('..'+self.config.currentClass).removeClass(self.config.currentClass);
$parent.addClass(self.config.currentClass);
},
bindInterval:function(){
var self=这个;
八分之八;
self.$win.on('scroll.onePageNav',function(){
self.didcoll=true;
});
self.t=setInterval(函数(){
docHeight=自身$doc.height();
//如果它是滚动的
if(self.didcoll){
self.didcoll=false;
self.scrollChange();
}
//如果文档高度发生变化
if(docHeight!==self.docHeight){
self.docHeight=docHeight;
self.getPositions();
}
}, 250);
},
getHash:function($link){
返回$link.attr('href').split('#')[1];
},
getPositions:function(){
var self=这个;
var-linkHref;
var topPos;
var$目标;
self.$nav.每个(函数(){
linkHref=self.getHash($(this));
$target=$(“#”+linkHref);
如果($target.length){
topPos=$target.offset().top;
self.sections[linkHref]=Math.round(topPos);
}
});
},
getSection:函数(windowPos){
var returnValue=null;
var windowHeight=Math.round(this.$win.height()*this.config.scrollThreshold);
for(本节中的var节){
如果((本节[节]-窗高)