diff options
author | Scott González <scott.gonzalez@gmail.com> | 2011-01-14 14:35:37 -0500 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2011-01-14 14:35:37 -0500 |
commit | 66606407edf9faa33c566f0cc6a2bb1dd4d3e808 (patch) | |
tree | d404ba5808418cb55435d914008cd88ced3851ed /ui/jquery.ui.accordion.js | |
parent | 1b2f6ce0955f2a08a2e52c688f23335423179cf1 (diff) | |
download | jquery-ui-66606407edf9faa33c566f0cc6a2bb1dd4d3e808.tar.gz jquery-ui-66606407edf9faa33c566f0cc6a2bb1dd4d3e808.zip |
Accordion: Force the width of the accordion panel during animation when animating from a fully collapsed state. Fixes #5540 - Accordion: Jumpy animation when opening a panel after closing all.
The animation code should be refactored.
Diffstat (limited to 'ui/jquery.ui.accordion.js')
-rw-r--r-- | ui/jquery.ui.accordion.js | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index 098ca4090..a31abd198 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -499,16 +499,34 @@ $.extend( $.ui.accordion, { version: "@VERSION", animations: { slide: function( options, additions ) { + var overflow = options.toShow.css( "overflow" ), + percentDone = 0, + showProps = {}, + hideProps = {}, + fxAttrs = [ "height", "paddingTop", "paddingBottom" ], + originalWidth; options = $.extend({ easing: "swing", duration: 300 }, options, additions ); if ( !options.toHide.size() ) { - options.toShow.animate({ - height: "show", - paddingTop: "show", - paddingBottom: "show" - }, options ); + originalWidth = options.toShow[0].style.width; + options.toShow + .show() + .width( options.toShow.width() ) + .hide() + .animate({ + height: "show", + paddingTop: "show", + paddingBottom: "show" + }, { + duration: options.duration, + easing: options.easing, + complete: function() { + options.toShow.width( originalWidth ); + options.complete(); + } + }); return; } if ( !options.toShow.size() ) { @@ -519,12 +537,6 @@ $.extend( $.ui.accordion, { }, options ); return; } - var overflow = options.toShow.css( "overflow" ), - percentDone = 0, - showProps = {}, - hideProps = {}, - fxAttrs = [ "height", "paddingTop", "paddingBottom" ], - originalWidth; // fix width before calculating height of hidden element var s = options.toShow; originalWidth = s[0].style.width; |