Skip to content

Commit

Permalink
Accordion: Reduced some code in _toggle().
Browse files Browse the repository at this point in the history
  • Loading branch information
scottgonzalez committed Feb 5, 2011
1 parent d808f93 commit e986bd8
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions ui/jquery.ui.accordion.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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();
Expand Down

0 comments on commit e986bd8

Please sign in to comment.