16
16
17
17
var uid = 0 ,
18
18
hideProps = { } ,
19
- showProps = { } ,
20
- showPropsAdjust = { } ;
19
+ showProps = { } ;
21
20
22
21
hideProps . height = hideProps . paddingTop = hideProps . paddingBottom =
23
22
hideProps . borderTopWidth = hideProps . borderBottomWidth = "hide" ;
24
23
showProps . height = showProps . paddingTop = showProps . paddingBottom =
25
24
showProps . borderTopWidth = showProps . borderBottomWidth = "show" ;
26
- $ . extend ( showPropsAdjust , showProps , { accordionHeight : "show" } ) ;
27
-
28
- $ . fx . step . accordionHeight = function ( fx ) {
29
- var elem = $ ( fx . elem ) ,
30
- data = elem . data ( "ui-accordion-height" ) ;
31
- elem . height ( data . total - elem . outerHeight ( ) - data . toHide . outerHeight ( ) + elem . height ( ) ) ;
32
- } ;
33
25
34
26
$ . widget ( "ui.accordion" , {
35
27
version : "@VERSION" ,
@@ -485,12 +477,12 @@ $.widget( "ui.accordion", {
485
477
_animate : function ( toShow , toHide , data ) {
486
478
var total , easing , duration ,
487
479
that = this ,
480
+ adjust = 0 ,
488
481
down = toShow . length &&
489
482
( ! toHide . length || ( toShow . index ( ) < toHide . index ( ) ) ) ,
490
483
animate = this . options . animate || { } ,
491
484
options = down && animate . down || animate ,
492
485
complete = function ( ) {
493
- toShow . removeData ( "ui-accordion-height" ) ;
494
486
that . _toggleComplete ( data ) ;
495
487
} ;
496
488
@@ -512,15 +504,29 @@ $.widget( "ui.accordion", {
512
504
}
513
505
514
506
total = toShow . show ( ) . outerHeight ( ) ;
515
- toHide . animate ( hideProps , duration , easing ) ;
507
+ toHide . animate ( hideProps , {
508
+ duration : duration ,
509
+ easing : easing ,
510
+ step : function ( now , fx ) {
511
+ fx . now = Math . round ( now ) ;
512
+ }
513
+ } ) ;
516
514
toShow
517
515
. hide ( )
518
- . data ( "ui-accordion-height" , {
519
- total : total ,
520
- toHide : toHide
521
- } )
522
- . animate ( this . options . heightStyle === "content" ? showProps : showPropsAdjust ,
523
- duration , easing , complete ) ;
516
+ . animate ( showProps , {
517
+ duration : duration ,
518
+ easing : easing ,
519
+ complete : complete ,
520
+ step : function ( now , fx ) {
521
+ if ( fx . prop !== "height" ) {
522
+ fx . now = Math . round ( now ) ;
523
+ adjust += fx . now ;
524
+ } else {
525
+ fx . now = Math . round ( total - toHide . outerHeight ( ) - adjust ) ;
526
+ adjust = 0 ;
527
+ }
528
+ }
529
+ } ) ;
524
530
} ,
525
531
526
532
_toggleComplete : function ( data ) {
0 commit comments