David Walsh Blog

SmoothScroll Using MooTools 1.2

A while back I wrote a post about MooTools’ SmoothScroll plugin which allows you to smoothly take a user to a specific portion of a page. By default, the browser “jerks” you up or down in the page when you click on an anchor — SmoothScroll lets you define the duration that it should take for a link to be scrolled down to.

MooTools 1.2 has a slightly different usage of the SmoothScroll plugin. In Moo 1.2, you instantiate the plugin as follows:

//when the dom is ready
window.addEvent('domready',function() {
	//smooooooth scrolling enabled
	//new SmoothScroll({ options }, window);
	new SmoothScroll({ duration:700 }, window); //700 milliseconds to get there
});