Meet the RotatorContainer

Apr 25, 2008

I’ve been sitting on this code for a while and decided to clean it up and submit it to the Dojo Javascript Toolkit.

The RotatorContainer cycles through dijit.layout.ContentPanes and provides navigation in the form of tabs or a pager. There a number of timing settings you can adjust as well as the layout of the controls.

Give it a try!

Here’s how you can use it:

<script type="text/javascript">

<div dojoType="dojox.layout.RotatorContainer" id="myRotator" showTabs="true"
      autoStart="true" transitionDelay="5000">
    <div dojoType="dijit.layout.ContentPane" title="1">
        Pane 1!
    <div dojoType="dijit.layout.ContentPane" title="2">
        Pane 2!
    <div dojoType="dijit.layout.ContentPane" title="3">
        Pane 3!

NOTE: There is some CSS needed to make the RotatorContainer look correct. Include or copy the contents of the dojox/layout/resources/RotatorContainer.css into your CSS file.

The magic happens once you have some content. It takes a bit of time to tweak things, but you can pretty much do anything you can imagine.

The RotatorContainer can be controlled by a pager which includes a play/pause button, next and previous button, and the current and total panes. You can also have as many pagers as you’d like. The pager code looks like this:

<script type="text/javascript">

<div dojoType="dojox.layout.RotatorPager" rotatorId="myRotator">
    <button dojoType="dijit.form.Button" dojoAttachPoint="previous">Prev</button>
    <button dojoType="dijit.form.ToggleButton" dojoAttachPoint="playPause"></button>
    <button dojoType="dijit.form.Button" dojoAttachPoint="next">Next</button>
    <span dojoAttachPoint="current"></span> / <span dojoAttachPoint="total"></span>

One thing I should note, if this widget should find it’s way into dojox, it’s possible the name or functionality will change.

If time permitted, I would have liked to add additional transitions such as a left-to-right wipe. Oh well.



  1. Hi,

    I am using dojox.widget.rotator to display images.Now I’ve to display two images at a time but by default its displaying only one at a time).

    Any help,ideas is greatly appreciated.

    Kind Regards,

    Comment by Pads — October 12, 2011 @ 2:20 am

  2. Hi Pads,

    Try either putting two img tags in a single pane or combine both images into a single image.


    Comment by Chris Barber — October 12, 2011 @ 9:39 am

RSS feed for comments on this post. TrackBack URL

Sorry, the comment form is closed at this time.