mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Tabs: fixed a few issues in rotate method extension
This commit is contained in:
parent
240a588bce
commit
18171c2f89
@ -640,31 +640,34 @@ $.extend($.ui.tabs.prototype, {
|
|||||||
rotation: null,
|
rotation: null,
|
||||||
rotate: function(ms, continuing) {
|
rotate: function(ms, continuing) {
|
||||||
|
|
||||||
var self = this, o = this.options, t = o.selected;
|
var self = this, o = this.options;
|
||||||
|
|
||||||
var rotate = function() {
|
var rotate = self._rotate || (self._rotate = function(e) {
|
||||||
clearTimeout(self.rotation);
|
clearTimeout(self.rotation);
|
||||||
self.rotation = setTimeout(function() {
|
self.rotation = setTimeout(function() {
|
||||||
t = ++t < self.anchors.length ? t : 0;
|
var t = o.selected;
|
||||||
self.select(t);
|
self.select( ++t < self.anchors.length ? t : 0 );
|
||||||
}, ms);
|
}, ms);
|
||||||
};
|
|
||||||
|
if (e) {
|
||||||
|
e.stopPropagation();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
var stop = !continuing ?
|
var stop = self._unrotate || (self._unrotate = !continuing ?
|
||||||
function(e) {
|
function(e) {
|
||||||
if (e.clientX) { // in case of a true click
|
if (e.clientX) { // in case of a true click
|
||||||
clearTimeout(self.rotation);
|
self.rotate(null);
|
||||||
self.element.unbind('tabsshow', rotate);
|
|
||||||
}
|
}
|
||||||
} :
|
} :
|
||||||
function(e) {
|
function(e) {
|
||||||
t = o.selected;
|
t = o.selected;
|
||||||
rotate();
|
rotate();
|
||||||
};
|
});
|
||||||
|
|
||||||
// start rotation
|
// start rotation
|
||||||
if (ms) {
|
if (ms) {
|
||||||
this.element.bind('tabsshow', rotate); // will not be attached twice
|
this.element.bind('tabsshow', rotate);
|
||||||
this.anchors.bind(o.event + '.tabs', stop);
|
this.anchors.bind(o.event + '.tabs', stop);
|
||||||
rotate();
|
rotate();
|
||||||
}
|
}
|
||||||
@ -673,6 +676,8 @@ $.extend($.ui.tabs.prototype, {
|
|||||||
clearTimeout(self.rotation);
|
clearTimeout(self.rotation);
|
||||||
this.element.unbind('tabsshow', rotate);
|
this.element.unbind('tabsshow', rotate);
|
||||||
this.anchors.unbind(o.event + '.tabs', stop);
|
this.anchors.unbind(o.event + '.tabs', stop);
|
||||||
|
delete this._rotate;
|
||||||
|
delete this._unrotate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user