diff options
Diffstat (limited to 'ui/jquery.ui.accordion.js')
-rw-r--r-- | ui/jquery.ui.accordion.js | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js index 00ecd1b64..fe1771bc8 100644 --- a/ui/jquery.ui.accordion.js +++ b/ui/jquery.ui.accordion.js @@ -12,10 +12,11 @@ * jquery.ui.widget.js */ (function( $, undefined ) { - var uid = 0, - hideProps = {}, - showProps = {}, - showPropsAdjust = {}; + +var uid = 0, + hideProps = {}, + showProps = {}, + showPropsAdjust = {}; hideProps.height = hideProps.paddingTop = hideProps.paddingBottom = hideProps.borderTopWidth = hideProps.borderBottomWidth = "hide"; @@ -166,8 +167,7 @@ $.widget( "ui.accordion", { }, _destroy: function() { - var contents, - accordionId = this.accordionId; + var contents; // clean up main element this.element @@ -410,9 +410,8 @@ $.widget( "ui.accordion", { this._toggle( eventData ); // switch classes - active - .removeClass( "ui-accordion-header-active ui-state-active ui-corner-top" ) - .addClass( "ui-corner-all" ); + // corner classes on the previously active header stay after the animation + active.removeClass( "ui-accordion-header-active ui-state-active" ); if ( options.icons ) { active.children( ".ui-accordion-header-icon" ) .removeClass( options.icons.activeHeader ) @@ -496,10 +495,10 @@ $.widget( "ui.accordion", { easing = easing || options.easing || animate.easing; duration = duration || options.duration || animate.duration; - if ( !toHide.size() ) { + if ( !toHide.length ) { return toShow.animate( showProps, duration, easing, complete ); } - if ( !toShow.size() ) { + if ( !toShow.length ) { return toHide.animate( hideProps, duration, easing, complete ); } @@ -516,11 +515,14 @@ $.widget( "ui.accordion", { }, _toggleComplete: function( data ) { - var toShow = data.newContent, - toHide = data.oldContent; + var toHide = data.oldContent; + + toHide + .removeClass( "ui-accordion-content-active" ) + .prev() + .removeClass( "ui-corner-top" ) + .addClass( "ui-corner-all" ); - // other classes are removed before the animation; this one needs to stay until completed - toHide.removeClass( "ui-accordion-content-active" ); // Work around for rendering bug in IE (#5421) if ( toHide.length ) { toHide.parent()[0].className = toHide.parent()[0].className; |