Fx.Scroll

Here is the documentation for Fx.Scroll.js.

Smooth scrolling is pretty easy to manage with the Fx.Scroll class. You can scroll elements (like a div or a paragraph that has an overflow and thus a scroll bar) or the window.

Basic syntax:

new Fx.Scroll(element, options)

The options are the same as the Fx options, and the element is any DOM element or the window (that has an overflow, obviously).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

var scrollExample = new Fx.Scroll($('scrollExample'));
scrollExample.start(0, 120);
execute this code
var scrollExample = new Fx.Scroll($('scrollExample'));
scrollExample.toTop(); //go to the top
execute this code
var scrollExample = new Fx.Scroll($('scrollExample'));
scrollExample.toBottom(); //to the bottom
execute this code

There are also functions .toRight(), .toLeft(), .scrollTo(x,y) and .toElement().

Window example:

var winScroller = new Fx.Scroll(window);
	/*	scroll to the top	*/
	winScroller.toTop().chain(function (){
	/*	then back to here	*/
	winScroller.toElement('fxScrollWindowExample');
});
execute this code

mootorial/08-plugins/00-fxplugins/01-fx.scroll.txt · Last modified: 2008/10/27 23:53