My .scrollTop() is just not working. It’s used in a function (which do get called – checked with an alert) but nothing happens.
I tried:
$(window).scrollTop();
$("html").scrollTop();
$(document).scrollTop();
I tried them separately and together, and it just doesn’t do anything.
All I need to do is let my page scroll to the top. Any tips and tricks?
You need
$("html, body").scrollTop(0);that is a cross-browser solution to scroll to the vertical position 0 (to the top).The way you are doing
scrollTop()does nothing because its a getter that returns the current vertical position.