aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott González <scott.gonzalez@gmail.com>2011-02-04 23:50:49 -0500
committerScott González <scott.gonzalez@gmail.com>2011-02-04 23:50:49 -0500
commite986bd8877a3ebceb301ea015742bb5bec65a68d (patch)
treee37f10eedb1f54e423854f1bbacd7353fd264c70
parentd808f933eb6457426136ab6e319821bb25f45f7a (diff)
downloadjquery-ui-e986bd8877a3ebceb301ea015742bb5bec65a68d.tar.gz
jquery-ui-e986bd8877a3ebceb301ea015742bb5bec65a68d.zip
Accordion: Reduced some code in _toggle().
-rw-r--r--ui/jquery.ui.accordion.js26
1 files changed, 11 insertions, 15 deletions
diff --git a/ui/jquery.ui.accordion.js b/ui/jquery.ui.accordion.js
index ad96cfb91..61b1f2eb5 100644
--- a/ui/jquery.ui.accordion.js
+++ b/ui/jquery.ui.accordion.js
@@ -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();