jQuery To Scroll To A Specific Element
I thought I’d share a useful snippit of jQuery code for scrolling to a specific element on a page.
|
1 2 3 |
$('html, body').animate({ scrollTop: ($('#element').offset().top) },500); |
We use the .animate() method to scroll to the top of #element, over a period of 500 milliseconds. jQuery To … Continued