dojox/widget/rotator/ThumbnailController.js

  • Provides:

    • dojox.widget.rotator.ThumbnailController
  • dojox.widget.rotator.ThumbnailController

    • type
      Function
    • summary
      Initializes the thumbnails and connect to the rotator.
    • description
      The ThumbnailController will look at each of the rotator's panes and
      only if the node is an <img> tag, then it will create an thumbnail of
      the pane's image using the <img> tag's "thumbsrc" or "src" attribute.
      
      The size of the thumbnails and the style of the selected thumbnail is
      controlled using CSS.
    • example
      
      	<div dojoType="dojox.widget.Rotator" jsId="myRotator">
      		<img src="/path/to/image1.jpg" thumbsrc="/path/to/thumb1.jpg" alt="Image 1"/>
      		<img src="/path/to/image2.jpg" thumbsrc="/path/to/thumb2.jpg" alt="Image 2"/>
      	</div>
      	<div dojoType="dojox.widget.rotator.ThumbnailController" rotator="myRotator"></div>
    • parameters:
      • params: (typeof Object)
      • node: (typeof DomNode|string)
    • source: [view]
         d.mixin(this, params);


         this._domNode = node;


         // check if we have a valid rotator
         var r = this.rotator;
         if(r){
          // remove all of the controller's child nodes just in case
          while(node.firstChild){
           node.removeChild(node.firstChild);
          }


          for(var i=0; i     var n = r.panes[i].node,
            s = d.attr(n, "thumbsrc") || d.attr(n, "src"),
            t = d.attr(n, "alt") || "";


           if(/img/i.test(n.tagName)){
            (function(j){
             d.create("a", {
              classname: _css + ' ' + _css + j + ' ' + (j == r.idx ? _selected : ""),
              href: s,
              onclick: function(e){
               d.stopEvent(e);
               if(r){
                r.control.apply(r, ["go", j]);
               }
              },
              title: t,
              innerHTML: '' + t + ''
             }, node);
            })(i);
           }
          }


          this._con = d.connect(r, "onUpdate", this, "_onUpdate");
         }
    • chains:
      • r.control: (call)
  • dojox.widget.rotator.ThumbnailController.rotator

    • type
      dojox.widget.Rotator
    • summary
      An instance of a Rotator widget.
  • dojox.widget.rotator.ThumbnailController.destroy

    • type
      Function
    • source: [view]
         d.disconnect(this._con);
         d.destroy(this._domNode);
    • summary
      Disconnect from the rotator.
  • dojox.widget.rotator.ThumbnailController._onUpdate

    • type
      Function
    • parameters:
      • type: (typeof string)
    • source: [view]
         var r = this.rotator; // no need to test if this is null since _onUpdate is only fired by the rotator
         if(type == "onAfterTransition"){
          var n = d.query('.' + _css, this._domNode).removeClass(_selected);
          if(r.idx < n.length){
           d.addClass(n[r.idx], _selected);
          }
         }
    • summary
      Updates various pager controls when the rotator updates.
  • dojox.widget.rotator.ThumbnailController._domNode

    • summary
  • dojox.widget.rotator.ThumbnailController._con

    • summary
  • _selected

    • summary
  • dojox.widget.rotator

    • type
      Object
    • summary
  • dojox.widget

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary