|
94 | 94 |
|
95 | 95 | $.tools.tabs.addEffect("horizontal", function(i, done) { |
96 | 96 |
|
97 | | - var nextPane = this.getPanes().eq(i); |
98 | | - |
| 97 | + var nextPane = this.getPanes().eq(i), |
| 98 | + currentPane = this.getCurrentPane(); |
| 99 | + |
99 | 100 | // store original width of a pane into memory |
100 | 101 | w || ( w = this.getPanes().eq(0).width() ); |
101 | 102 |
|
102 | 103 | nextPane.show(); // hidden by default |
103 | 104 |
|
104 | | - // set current pane's width to zero |
105 | | - // animate next pane at the same time for smooth animation |
106 | | - this.getCurrentPane().animate({width: 0}, { |
| 105 | + // animate current pane's width to zero |
| 106 | + // animate next pane's width at the same time for smooth animation |
| 107 | + currentPane.animate({width: 0}, { |
107 | 108 | step: function(now){ |
108 | 109 | nextPane.css("width", w-now); |
109 | 110 | }, |
110 | 111 | complete: function(){ |
111 | 112 | $(this).hide(); |
112 | 113 | done.call(); |
113 | 114 | } |
114 | | - }); |
| 115 | + }); |
| 116 | + // Dirty hack... onLoad, currentPant will be empty and nextPane will be the first pane |
| 117 | + // If this is the case, manually run callback since the animation never occured |
| 118 | + if (!currentPane.length){ done.call(); } |
115 | 119 | }); |
116 | 120 |
|
117 | 121 |
|
|
134 | 138 | $.extend(this, { |
135 | 139 | click: function(i, e) { |
136 | 140 |
|
137 | | - var tab = tabs.eq(i); |
| 141 | + var tab = tabs.eq(i); |
138 | 142 |
|
139 | 143 | if (typeof i == 'string' && i.replace("#", "")) { |
140 | 144 | tab = tabs.filter("[href*=" + i.replace("#", "") + "]"); |
|
164 | 168 |
|
165 | 169 | // call the effect |
166 | 170 | effects[conf.effect].call(self, i, function() { |
167 | | - |
168 | 171 | current = i; |
169 | 172 | // onClick callback |
170 | 173 | e.type = "onClick"; |
|
258 | 261 |
|
259 | 262 | } else { |
260 | 263 | if (conf.initialIndex === 0 || conf.initialIndex > 0) { |
261 | | - current = conf.initialIndex; // ensure that current is set properly |
262 | 264 | self.click(conf.initialIndex); |
263 | 265 | } |
264 | 266 | } |
|
0 commit comments