Scrolling to the Top and Bottom of the page using Mootools

June 4th, 2010 | Mootools

Scrolling to the top and bottom is very easy in mootools. Check out the code below.

window.addEvent('domready', function(){

	var myFx = new Fx.Scroll(window);

	$('bottom').addEvent('click', function(e){
		e.stop();
		myFx.toBottom();
	});

	$('top').addEvent('click', function(e){
		e.stop();
		myFx.toTop();
	});

});

Lines 5-8 lets you scroll to the bottom of the page. While lines 10-13 lets you scroll to the top of the page. Easy huh?

Note: Fx.Scroll plugin must be included. Get it at Mootools More Builder.

Check out the demo

Leave a Reply

  • Name (required)
  • Mail (will not be published) (required)
  • Website
  • Message