Dojo Smooth Scrolling
Written by on November 14th, 2006 in Ajax News.
There have been requests for smooth scrolling widgets in Dojo, and Heng Liu stood up tot he plate by implementing dojo.lfx.smoothScroll.
Along with this new dojo.lfx resource, other improvements include:
dojo.html.getAbsolutePositionis extended to be compatible withdojo.withGlobal- a new function,
dojo.html.getAbsolutePositionExtis introduced in resourcedojo.html.utilto include support for getting abosolute postion of a node in iframes with regards to a given window. The reason why this is not merged intodojo.html.getAbsolutePositionis that, this new feature depends on APIs defined indojo.html.util. In order to avoid introducing it as a dependency indojo.html.layout, this design decision is made.
To see it in action check out this test page and click on the buttons on the top left to see the items scroll.
Example Usage
dojo.event.connect(dojo.byId(”goToHeader0″), “onclick”, function (e) {
var h2s = dojo.html.iframeContentDocument(dojo.byId(”embed0″)).getElementsByTagName(’h2′);
var h2 = h2s[h2s.length-1];
var anm = new dojo.lfx.smoothScroll(h2,dojo.html.iframeContentWindow(dojo.byId(”embed0″)),null,500);
anm.play();
});
var h2s = dojo.html.iframeContentDocument(dojo.byId(”embed0″)).getElementsByTagName(’h2′);
var h2 = h2s[h2s.length-1];
var anm = new dojo.lfx.smoothScroll(h2,dojo.html.iframeContentWindow(dojo.byId(”embed0″)),null,500);
anm.play();
});
The entire thing is pretty small, take a peek for yourself
Source: Ajaxian
Original Article: http://ajaxian.com/archives/dojo-smooth-scrolling