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
精彩评论