$('body,html').animate({
scrollTop:$('.itemBox').eq(index).offset().top
},800)
itemBox是要滚动到顶部的盒子的类名,如果是整个页面滚动到顶部,就用 body,html代替itemBox
index是侧边导航栏按钮的索引
$('body,html').animate({
scrollTop:$('.itemBox').eq(index).offset().top
},800)
itemBox是要滚动到顶部的盒子的类名,如果是整个页面滚动到顶部,就用 body,html代替itemBox
index是侧边导航栏按钮的索引