Skip to content

Commit e986bd8

Browse files
committed
Accordion: Reduced some code in _toggle().
1 parent d808f93 commit e986bd8

File tree

1 file changed

+11
-15
lines changed

1 file changed

+11
-15
lines changed

ui/jquery.ui.accordion.js

+11-15
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,7 @@ $.widget( "ui.accordion", {
341341
var self = this,
342342
options = self.options,
343343
toShow = data.newContent,
344-
toHide = data.oldContent,
345-
down = toShow.length && ( !toHide.length || ( toShow.index() < toHide.index() ) );
344+
toHide = data.oldContent;
346345

347346
self.running = true;
348347
function complete() {
@@ -351,27 +350,24 @@ $.widget( "ui.accordion", {
351350

352351
if ( options.animated ) {
353352
var animations = $.ui.accordion.animations,
354-
easing = options.animated;
353+
animation = options.animated,
354+
additional;
355355

356-
if ( easing && !animations[ easing ] && !$.easing[ easing ] ) {
357-
easing = "slide";
358-
}
359-
if ( !animations[ easing ] ) {
360-
animations[ easing ] = function( options ) {
361-
this.slide( options, {
362-
easing: easing,
363-
duration: 700
364-
});
356+
if ( !animations[ animation ] ) {
357+
additional = {
358+
easing: $.easing[ animation ] ? animation : "slide",
359+
duration: 700
365360
};
361+
animation = "slide";
366362
}
367363

368-
animations[ easing ]({
364+
animations[ animation ]({
369365
toShow: toShow,
370366
toHide: toHide,
371367
complete: complete,
372-
down: down,
368+
down: toShow.length && ( !toHide.length || ( toShow.index() < toHide.index() ) ),
373369
autoHeight: options.heightStyle !== "content"
374-
});
370+
}, additional );
375371
} else {
376372
toHide.hide();
377373
toShow.show();

0 commit comments

Comments
 (0)