开发者

Make all <li>s, when clicked, scroll to a single anchor?

I have around 30 li nodes. When each one is clicked, I would like the browser to gently scroll to the div sliderbox. (I don't wnt to use anchor tags)

So, something like this:

$("#boxcont li").click(function(event){
   // (Make stuff happen here)
)开发者_开发百科};

How can I do this?


check ths out

$("#boxcont li").click(function(event){
$('html,body').animate({ scrollTop: $('#sliderbox').offset().top }, { duration: 'slow', easing: 'swing'});
});


you can try this: document.location=document.location + "#anchorName"; add <a name="anchorName"></a> in the location you wish to scroll to

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜