-1

I am trying to get my page to scroll to the top. It works in Chrome but not Firefox. I have read threads on here and tried them, but none have worked. These are the ones I have tried.

window.scrollTo(0,0);
jQuery(window).scrollTop();
jQuery(window).scrollTo();
jQuery(window).scrollTo(0,0);
JJJ
  • 32,902
  • 20
  • 89
  • 102
DennisOakdale
  • 39
  • 2
  • 8
  • I'm going to assume that by "Mozilla" you mean Firefox, edit back if not. Mozilla is the organization that makes the browser, not the browser's name. – JJJ Dec 05 '16 at 17:19
  • How are you calling it? – epascarello Dec 05 '16 at 17:20
  • It isn't being called, just running it in script tags at the bottom of the page, idea being when all html and other javascript code runs then it will last and move the page to the top (its loading at the bottom currently) – DennisOakdale Dec 05 '16 at 17:29

1 Answers1

1

The scroll top should be triggered on the document element

$(document).scrollTop(0);

You may also use the .animate() if you wanna to add an slow effect

$("html, body").animate({ scrollTop: 0 });