SMOOTHLY SCROLL TO AN ELEMENT WITHOUT A JQUERY PLUGIN

Source: http://www.abeautifulsite.net/blog/2010/01/smoothly-scroll-to-an-element-without-a-jquery-plugin/
After spending some time looking for a plugin to do this, I was amazed to see how easy it was to get a smooth scrolling effect using one line of jQuery.  You can use this inside of any callback function.  It works especially well with click.

$('html, body').animate({
 scrollTop: $("#elementID").offset().top
}, 2000);
Although LocalScroll is good for more advanced applications, this snippet is useful for one-time use applications.  Simply adjust #elementID and 2000 to set the element and duration, respectively.

Comments

Popular posts from this blog

How to prepare your LOB app for Intune?

Information Architecture - Setup your term store to scale

Generate token signing .CER from ADFS Federation Metadata XML