1

How can I get the user to the top of a section using jQuery, but NOT by scrolling? For example, I have this bit of code which works -

$("button").click(function() {
    $("#myDiv").animate({ scrollTop: 0 });
});

But it of course scrolls the user to the top of the section. I want to achieve this without having the visually obvious scrolling effect happen. Any way to have that happen?

yerme
  • 810
  • 5
  • 15

1 Answers1

0

You can do this without Javascript if you want:

<div id="myDiv">Here is some content</div>

<a href="#myDiv">Link to My Div</a>
willi
  • 119
  • 3