2

By click on a button, I want to go to the top of the page. but it should not scroll to the top (no animation), instead it should go immediately to the top (just like a new page load). Is this possible with jquery? Thank you very much!

Ryan Vincent
  • 4,438
  • 7
  • 21
  • 31
fala
  • 241
  • 2
  • 12

2 Answers2

5

window.scrollTo(x-coord, y-coord);

Seth McClaine
  • 7,625
  • 6
  • 37
  • 56
1

You do not need jQuery to achieve this. All you need is a simple anchor tag right after the body tag.

<a name="anchor"> </a>

And to navigate there you would use.

 <a href="#anchor">This will send you to the anchor.</a>
Darkrum
  • 1,257
  • 1
  • 10
  • 27