]> source.dussan.org Git - jquery-ui.git/commitdiff
Tabs: fixed stopping a rotation
authorKlaus Hartl <klaus.hartl@googlemail.com>
Sat, 28 Feb 2009 22:10:30 +0000 (22:10 +0000)
committerKlaus Hartl <klaus.hartl@googlemail.com>
Sat, 28 Feb 2009 22:10:30 +0000 (22:10 +0000)
ui/ui.tabs.js

index 2a7b30a408dfc23cacde535d3c77ce34d35524e8..cfbdbd4a8c9a9ca8a55513f65f674e4ad40b4fa5 100644 (file)
@@ -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