Opened 9 years ago

Closed 9 years ago

Last modified 6 years ago

#4924 closed bug (worksforme)

Broken toggleClass(...) method

Reported by: sshark Owned by:
Priority: major Milestone:
Component: ui.effects.core Version: 1.7.2
Keywords: toggleClass duration Cc:
Blocked by: Blocking:

Description

Hi,

I found that if I clicked "Run Effect" in http://jqueryui.com/demos/toggleClass/ before the animation is completed, the box wouldn't animate again.

I am using FF 3.5.3 (Mac SL) and IE8.

Thanks

Change History (3)

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

This happens because the class animations grab the current style settings before the animation begins so that it can restore them after the animation completes (since it needs to modify those settings to do the animation). By running a second class animation during an existing class animation, the second one restores the style settings at the time that the second animation began. This will contain settings for all of the properties that will be animated during subsequent animations. This would require the clear inline styles option from #3928 to make this work, and even then it wouldn't be exactly what the user expects.

comment:2 Changed 9 years ago by Scott González

Resolution: worksforme
Status: newclosed

You could accomplish what you want by calling .stop(true, true) before calling .toggleClass(). I'm not inclined to change the demo.

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

Milestone: TBD

Milestone TBD deleted

Note: See TracTickets for help on using tickets.