Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#9224 closed bug (worksforme)

using toggleClass('myClass', 1000) does not animate the

Reported by: BenEllis Owned by:
Priority: minor Milestone: none
Component: ui.effects.core Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:

Description

http://jsfiddle.net/BenEllis/vxhUN/1/

reproduced in IE9, Firefox 19.02, Chrome 26.0.1410.64 m in 64-bit Windows 7 Enterprise

When a switch parameter is not supplied, the toggleClass method does not work when specifying animation parameters.

It looks fairly obvious from the jquery.ui.effect.js code below that the wrong parameters are being passed to animateClass,

toggleClass: (function( orig ) {
		return function( classNames, force, speed, easing, callback ) {
			if ( typeof force === "boolean" || force === undefined ) {
				if ( !speed ) {
					// without speed parameter
					return orig.apply( this, arguments );
				} else {
					return $.effects.animateClass.call( this,
						(force ? { add: classNames } : { remove: classNames }),
						speed, easing, callback );
				}
			} else {
				// without force parameter
				return $.effects.animateClass.call( this,
					{ toggle: classNames }, force, speed, easing );
			}
		};

I have a patch with a fix for this and Ticket #9223 that I will attach shortly.

Change History (2)

comment:1 Changed 6 years ago by Scott González

Resolution: worksforme
Status: newclosed

I'm not sure what is fairly obvious here, but your fiddle has all kinds of crazy styles rules that don't make sense. The most obvious being that myanimatedclass is chained with outer2, so it's obviously not going to affect the div with outer.

This is working just fine: http://jsfiddle.net/vxhUN/2/

Last edited 6 years ago by Scott González (previous) (diff)

comment:2 Changed 6 years ago by BenEllis

Thanks for looking at this, sorry for wasting your time.

The crazy styles were copied over from the previous issues example, I forgot to take them out.

Note: See TracTickets for help on using tickets.