Activate your free membership today | Log-in

Tuesday, November 14th, 2006

Dojo Smooth Scrolling

Category: Component, Dojo, JavaScript

<p>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.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.

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

JAVASCRIPT:
  1.  
  2. dojo.event.connect(dojo.byId("goToHeader0"), "onclick", function (e) {
  3.         var h2s = dojo.html.iframeContentDocument(dojo.byId("embed0")).getElementsByTagName('h2');
  4.         var h2 = h2s[h2s.length-1];
  5.         var anm = new dojo.lfx.smoothScroll(h2,dojo.html.iframeContentWindow(dojo.byId("embed0")),null,500);
  6.         anm.play();
  7. });
  8.  

The entire thing is pretty small, take a peek for yourself

Related Content:

  • IBM goes open source with Ajax
    IBM is partnering with the Open Source Dojo Foundation in its quest to improve Ajax development. Big Blue also donated code to Dojo to help jumpstart...
  • Microsoft puts a tilt on the mouse wheel
    Microsoft is reinventing the mouse wheel, adding tilt wheel technology for horizontal scrolling and smoothing the vertical...
  • Sun gets serious about Ajax
    Sun Microsystems Inc. demonstrates a commitment to Ajax with its new involvement with to alliances working on Ajax technology, the OpenAJAX Alliance...
  • Ajax framework released
    Simplified Ajax development is the goal of a new framework from Emergetk, released under the General Public License (GPL). It is written in C# and the...
  • Hot skills: Dojo encourages Ajax innovation
    What is it? In April 2006, a reviewer provided a round-up of 50 different Ajax frameworks and toolsets - and the number has certainly increased since...

Posted by Dion Almaer at 12:27 pm
3 Comments

+++--
3.8 rating from 39 votes

3 Comments »

Comments feed TrackBack URI

Dojo Smooth Scrolling

This is pretty cool, but it’s pretty easy to implement with jQuery or any other Frameworks out there.
http://archive.dojotoolkit.org/nightly/tests/lfx/test_scroll.html

Trackback by Programming in the State of 70% Drunkeness — November 14, 2006

[...] Ajaxian » Dojo (tags: Development_Ajax_Dojo) [...]

Pingback by links for 2006-11-15 at Amy Stephen — November 15, 2006

Hmmm… I’m a bit confused by all the red text which says ‘This should be green’.

Is that a problem or just to make people like me confused?!

Comment by Dan Atkinson — November 16, 2006

Leave a comment

You must be logged in to post a comment.