diff options
author | Klaus Hartl <klaus.hartl@googlemail.com> | 2009-03-01 15:27:40 +0000 |
---|---|---|
committer | Klaus Hartl <klaus.hartl@googlemail.com> | 2009-03-01 15:27:40 +0000 |
commit | 18171c2f89b87ac61383fdde6c1dfed7d2541b44 (patch) | |
tree | 41d50c1a85df5d27dcf13adc33ffc72e20be64b8 /ui/ui.tabs.js | |
parent | 240a588bce03e72ca48527f3f7887261f505999b (diff) | |
download | jquery-ui-18171c2f89b87ac61383fdde6c1dfed7d2541b44.tar.gz jquery-ui-18171c2f89b87ac61383fdde6c1dfed7d2541b44.zip |
Tabs: fixed a few issues in rotate method extension
Diffstat (limited to 'ui/ui.tabs.js')
-rw-r--r-- | ui/ui.tabs.js | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/ui/ui.tabs.js b/ui/ui.tabs.js index 1fa32962a..1a52ce3ee 100644 --- a/ui/ui.tabs.js +++ b/ui/ui.tabs.js @@ -640,31 +640,34 @@ $.extend($.ui.tabs.prototype, { rotation: null, rotate: function(ms, continuing) { - var self = this, o = this.options, t = o.selected; - - var rotate = function() { + var self = this, o = this.options; + + var rotate = self._rotate || (self._rotate = function(e) { clearTimeout(self.rotation); self.rotation = setTimeout(function() { - t = ++t < self.anchors.length ? t : 0; - self.select(t); + var t = o.selected; + self.select( ++t < self.anchors.length ? t : 0 ); }, ms); - }; + + if (e) { + e.stopPropagation(); + } + }); - var stop = !continuing ? + var stop = self._unrotate || (self._unrotate = !continuing ? function(e) { if (e.clientX) { // in case of a true click - clearTimeout(self.rotation); - self.element.unbind('tabsshow', rotate); + self.rotate(null); } } : function(e) { t = o.selected; rotate(); - }; + }); // start rotation if (ms) { - this.element.bind('tabsshow', rotate); // will not be attached twice + this.element.bind('tabsshow', rotate); this.anchors.bind(o.event + '.tabs', stop); rotate(); } @@ -673,6 +676,8 @@ $.extend($.ui.tabs.prototype, { clearTimeout(self.rotation); this.element.unbind('tabsshow', rotate); this.anchors.unbind(o.event + '.tabs', stop); + delete this._rotate; + delete this._unrotate; } } }); |