Gandalf StormCrow Gandalf StormCrow - 3 months ago 19
jQuery Question

Slow down scroll to top event by jQuery animate

I'd like my page to go to the top when certain anchor is clicked.

Here is how I tried to do it but it's not working, it's scrolling super fast.

$('a[href=#top]').click(function () {
$('body').animate({
scrollTop: 0
},
50);
});


I want to slow it down.

ant ant
Answer
$('a[href=#top]').click(function(){
    $('html, body').animate({scrollTop:0}, 'slow');
});

Perhaps?