diff options
author | Chi Cheng <cloudream@gmail.com> | 2009-07-27 17:35:54 +0000 |
---|---|---|
committer | Chi Cheng <cloudream@gmail.com> | 2009-07-27 17:35:54 +0000 |
commit | 010a225af3aa1b7899ce97b27622b4d8556a764d (patch) | |
tree | 793da259b1273f4e742c7f660679a515b3f20148 /ui/effects.core.js | |
parent | f35bae5a7f364782aaf1ed2e7d8b5d4c1ac60bb1 (diff) | |
download | jquery-ui-010a225af3aa1b7899ce97b27622b4d8556a764d.tar.gz jquery-ui-010a225af3aa1b7899ce97b27622b4d8556a764d.zip |
Effects: handle switch parameter in toggleClass, fixes #4722
Diffstat (limited to 'ui/effects.core.js')
-rw-r--r-- | ui/effects.core.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/ui/effects.core.js b/ui/effects.core.js index 2cc7542f2..e41d71441 100644 --- a/ui/effects.core.js +++ b/ui/effects.core.js @@ -222,8 +222,18 @@ $.fn.extend({ }, _toggleClass: $.fn.toggleClass, - toggleClass: function(classNames,speed,easing,callback) { - return ( (typeof speed !== "boolean") && speed ) ? $.effects.animateClass.apply(this, [{ toggle: classNames },speed,easing,callback]) : this._toggleClass(classNames, speed); + toggleClass: function(classNames, force, speed, easing, callback) { + if ( typeof force == "boolean" || force === undefined ) { + if ( !speed ) { + // without speed parameter; + return this._toggleClass(classNames, force); + } else { + return $.effects.animateClass.apply(this, [(force?{add:classNames}:{remove:classNames}),speed,easing,callback]); + } + } else { + // without switch parameter; + return $.effects.animateClass.apply(this, [{ toggle: classNames },force,speed,easing]); + } }, switchClass: function(remove,add,speed,easing,callback) { |