Skip to content
Permalink
Browse files

Tabs: fixed stopping a rotation

  • Loading branch information...
Klaus Hartl
Klaus Hartl committed Feb 28, 2009
1 parent 517d5ab commit a02ac5f3721c14b2a20c29cdc7ddefc460a9f308
Showing with 15 additions and 14 deletions.
  1. +15 −14 ui/ui.tabs.js
@@ -639,29 +639,30 @@ $.extend($.ui.tabs.prototype, {

var self = this, o = this.options, t = o.selected;

function rotate() {
var rotate = function() {
clearTimeout(self.rotation);
self.rotation = setTimeout(function() {
t = ++t < self.anchors.length ? t : 0;
self.select(t);
}, ms);
}
};

var stop = !continuing ?
function(e) {
if (e.clientX) { // in case of a true click
clearTimeout(self.rotation);
self.element.unbind('tabsshow', rotate);
}
} :
function(e) {
t = o.selected;
rotate();
};

// start rotation
if (ms) {
this.element.bind('tabsshow', rotate); // will not be attached twice
this.anchors.bind(o.event + '.tabs', !continuing ?
function(e) {
if (e.clientX) { // in case of a true click
clearTimeout(self.rotation);
self.element.unbind('tabsshow', rotate);
}
} :
function(e) {
t = o.selected;
rotate();
}
);
this.anchors.bind(o.event + '.tabs', stop);
rotate();
}
// stop rotation

0 comments on commit a02ac5f

Please sign in to comment.
You can’t perform that action at this time.