How to jump to a div section in the same page by using jquery?

How to jump to a div section in the same page by using jquery?
0.0 0

#1

how to jump to a div section in the same page by using jquery?


#2

You actually don’t need jQuery for this. You can use an <a href="#id_of_element"></a> link. That will instantly jump to element when clicked. Just make sure the element has a matching ID.

If you want to animate, there are forthcoming CSS properties that allow for animation of scroll position, but they aren’t broadly supported yet. Until they are, I use a small jQuery plugin called .scrollTo().

Otherwise, if you really want to use jQuery or JavaScript and don’t want to animate or use the .scroll To plugin, what you want is to set the scrollTop property of the container you want to scroll to the top value of the element you want to scroll to.