Dojo Smooth Scrolling

As the requests for smooth scrolling widgets in Dojo keeps pouring in, Heng Liu took the initiative and implemented dojo.lfx.smoothScroll. Along with this new dojo.lfx resource, other improvements include: dojo.html.getAbsolutePosition is extended to be compatible with dojo.withGlobal a new function, dojo.html.getAbsolutePositionExt is introduced in resource dojo.html.util to include support for getting abosolute postion of a node in iframes […]

As the requests for smooth scrolling widgets in Dojo keeps pouring in, Heng Liu took the initiative and implemented dojo.lfx.smoothScroll.

Along with this new dojo.lfx resource, other improvements include:

  • dojo.html.getAbsolutePosition is extended to be compatible with dojo.withGlobal
  • a new function, dojo.html.getAbsolutePositionExt is introduced in resource dojo.html.util to include support for getting abosolute postion of a node in iframes with regards to a given window. The reason why this is not merged into dojo.html.getAbsolutePosition is that, this new feature depends on APIs defined in dojo.html.util. In order to avoid introducing it as a dependency in dojo.html.layout, this design decision is made.
    Demo: Note: Click Button on Top Right to see the effects.
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(); });

ajaxian

Dojo, Smooth Scrolling, Components