====== Fx.Scroll ====== Here is the [[http://docs.mootools.net/Plugins/Fx/Fx.Scroll|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 //[[00-fx|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); var scrollExample = new Fx.Scroll($('scrollExample')); scrollExample.toTop(); //go to the top var scrollExample = new Fx.Scroll($('scrollExample')); scrollExample.toBottom(); //to the bottom 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'); });