]> source.dussan.org Git - jquery-ui.git/commitdiff
Accordion: Reduced some code in _toggle().
authorScott González <scott.gonzalez@gmail.com>
Sat, 5 Feb 2011 04:50:49 +0000 (23:50 -0500)
committerScott González <scott.gonzalez@gmail.com>
Sat, 5 Feb 2011 04:50:49 +0000 (23:50 -0500)
ui/jquery.ui.accordion.js

index ad96cfb91c3811080c48b9103a679193d66e1981..61b1f2eb521fc995a193120a272a066166baf1d6 100644 (file)
@@ -341,8 +341,7 @@ $.widget( "ui.accordion", {
                var self = this,
                        options = self.options,
                        toShow = data.newContent,
-                       toHide = data.oldContent,
-                       down = toShow.length && ( !toHide.length || ( toShow.index() < toHide.index() ) );
+                       toHide = data.oldContent;
 
                self.running = true;
                function complete() {
@@ -351,27 +350,24 @@ $.widget( "ui.accordion", {
 
                if ( options.animated ) {
                        var animations = $.ui.accordion.animations,
-                               easing = options.animated;
+                               animation = options.animated,
+                               additional;
 
-                       if ( easing && !animations[ easing ] && !$.easing[ easing ] ) {
-                               easing = "slide";
-                       }
-                       if ( !animations[ easing ] ) {
-                               animations[ easing ] = function( options ) {
-                                       this.slide( options, {
-                                               easing: easing,
-                                               duration: 700
-                                       });
+                       if ( !animations[ animation ] ) {
+                               additional = {
+                                       easing: $.easing[ animation ] ? animation : "slide",
+                                       duration: 700
                                };
+                               animation = "slide";
                        }
 
-                       animations[ easing ]({
+                       animations[ animation ]({
                                toShow: toShow,
                                toHide: toHide,
                                complete: complete,
-                               down: down,
+                               down: toShow.length && ( !toHide.length || ( toShow.index() < toHide.index() ) ),
                                autoHeight: options.heightStyle !== "content"
-                       });
+                       }, additional );
                } else {
                        toHide.hide();
                        toShow.show();