/* Copyright (c) 2004-2012, The Dojo Foundation All Rights Reserved. Available via Academic Free License >= 2.1 OR the modified BSD license. see: http://dojotoolkit.org/license for details */ if(!dojo._hasResource["dojox.widget.rotator.ThumbnailController"]){ //_hasResource checks added by build. Do not use _hasResource directly in your code. dojo._hasResource["dojox.widget.rotator.ThumbnailController"] = true; dojo.provide("dojox.widget.rotator.ThumbnailController"); (function(d){ var _css = "dojoxRotatorThumb", _selected = _css + "Selected"; d.declare("dojox.widget.rotator.ThumbnailController", null, { // summary: // A rotator controller that displays thumbnails of each rotator pane. // // description: // The ThumbnailController will look at each of the rotator's panes and // only if the node is an tag, then it will create an thumbnail of // the pane's image using the tag's "thumbsrc" or "src" attribute. // // The size of the thumbnails and the style of the selected thumbnail is // controlled using CSS. // // example: // |
// | Image 1 // | Image 2 // |
// |
// rotator: dojox.widget.Rotator // An instance of a Rotator widget. rotator: null, constructor: function(/*Object*/params, /*DomNode|string*/node){ // summary: // Initializes the thumbnails and connect to the rotator. 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' }, node); })(i); } } this._con = d.connect(r, "onUpdate", this, "_onUpdate"); } }, destroy: function(){ // summary: // Disconnect from the rotator. d.disconnect(this._con); d.destroy(this._domNode); }, _onUpdate: function(/*string*/type){ // summary: // Updates various pager controls when the rotator updates. 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); } } } }); })(dojo); }