Skip to main content

Search and Top Navigation

#9224 closed bug (worksforme)

Opened April 12, 2013 11:11AM UTC

Closed April 12, 2013 11:37AM UTC

Last modified April 12, 2013 01:45PM UTC

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.

Attachments (0)
Change History (2)

Changed April 12, 2013 11:37AM UTC by scottgonzalez comment:1

_comment0: 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/BenEllis/vxhUN/1/1365766660437520
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/

Changed April 12, 2013 01:45PM UTC by BenEllis comment:2

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.