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.
$('a[href=#top]').click(function(){ $('html, body').animate({scrollTop:0}, 'slow'); });
Perhaps?
When you pass 50 as the second parameter to animate, that is 50 milliseconds. See the animate documentation. Either pass a larger number, or as c0mrade suggested, simply pass 'slow' .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With