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,483
  • 7
  • 22
  • 31
fala
  • 271
  • 3
  • 14

2 Answers2

5

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

Seth McClaine
  • 9,142
  • 6
  • 38
  • 64
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,325
  • 1
  • 10
  • 27