边栏 滚动

 <script>
$(function(){
var _go = [0,1017,1556,2205,3090,3968,$(document).height()];
var $jumpbar = $("#jumpbar"),
$window = $(window),
offset = $jumpbar.offset(),
topPadding = 100,
jL = $("#jumpbar a").length;
$(window).scroll(
function()
{
if($window.scrollTop() > offset.top)
{
$jumpbar.stop(true,true).animate(
{
top:$window.scrollTop()-offset.top + topPadding
},500
);
}
else
{
$jumpbar.stop(true,true).animate(
{
top:0
}
)
}
}
)

for(var i = 0; i <jL;i++)
{
$("#jumpbar a:nth-child("+(i+1)+")").click(function(i){return function(){$("html,body").stop(true,true).animate({scrollTop:_go[i]},500);}}(i));
}





});
</script>


 

  驼峰用于区别不同的模块(单词)【_】划线表明从属关系[-]表明组合 
原文地址:https://www.cnblogs.com/jinbiao/p/2312345.html