File tree Expand file tree Collapse file tree 2 files changed +20
-16
lines changed
Expand file tree Collapse file tree 2 files changed +20
-16
lines changed Original file line number Diff line number Diff line change 7878 }
7979 } ;
8080
81- var w ;
82-
8381 /**
8482 * Horizontal accordion
8583 *
8684 * @deprecated will be replaced with a more robust implementation
87- */
88- $ . tools . tabs . addEffect ( "horizontal" , function ( i , done ) {
85+ */
8986
87+ var w ;
88+
89+ $ . tools . tabs . addEffect ( "horizontal" , function ( i , done ) {
90+
9091 // store original width of a pane into memory
91- if ( ! w ) { w = this . getPanes ( ) . eq ( 0 ) . width ( ) ; }
92+ w || ( w = this . getPanes ( ) . eq ( 0 ) . width ( ) ) ;
9293
9394 // set current pane's width to zero
94- this . getCurrentPane ( ) . animate ( { width : 0 } , function ( ) { $ ( this ) . hide ( ) ; } ) ;
95-
96- // grow opened pane to it's original width
97- this . getPanes ( ) . eq ( i ) . animate ( { width : w } , function ( ) {
98- $ ( this ) . show ( ) ;
99- done . call ( ) ;
95+ this . getCurrentPane ( ) . animate ( { width : 0 } , function ( ) {
96+ $ ( this ) . hide ( ) ;
10097 } ) ;
10198
99+ // grow opened pane to it's original width
100+ this . getPanes ( ) . eq ( i ) . animate ( { width : w } , function ( ) {
101+ $ ( this ) . show ( ) ;
102+ done . call ( ) ;
103+ } ) ;
104+
102105 } ) ;
103106
104107
120123 // public methods
121124 $ . extend ( this , {
122125 click : function ( i , e ) {
123-
126+
124127 var tab = tabs . eq ( i ) ;
125128
126129 if ( typeof i == 'string' && i . replace ( "#" , "" ) ) {
149152 trigger . trigger ( e , [ i ] ) ;
150153 if ( e . isDefaultPrevented ( ) ) { return ; }
151154
152- current = i ;
153-
154155 // call the effect
155156 effects [ conf . effect ] . call ( self , i , function ( ) {
156157
157158 // onClick callback
158159 e . type = "onClick" ;
159160 trigger . trigger ( e , [ i ] ) ;
161+ current = i ;
160162 } ) ;
161163
162164 // default behaviour
Original file line number Diff line number Diff line change 11
2- < script src ="../js/jquery-1.4 .2.js "> </ script >
2+ < script src ="../js/jquery-1.6 .2.js "> </ script >
33< script src ="../../src/tabs/tabs.js "> </ script >
44< link rel ="stylesheet " type ="text/css " href ="css/horizontal.css "/>
55
@@ -38,5 +38,7 @@ <h3>Third pane</h3>
3838
3939
4040< script >
41- $ ( "#accordion" ) . tabs ( ".pane" , { tabs : '.blok' , effect : 'horizontal' } ) ;
41+ $ ( function ( ) {
42+ $ ( "#accordion" ) . tabs ( ".pane" , { tabs : '.blok' , effect : 'horizontal' } ) ;
43+ } ) ;
4244</ script >
You can’t perform that action at this time.
0 commit comments