Skip to content

Conversation

@Adovenmuehle
Copy link
Contributor

Hello,

In the ticket, the user is trying to change an element's class using switchClass multiple times, going from .blue to .red to .green and back to .blue.

Because switchClass evaluates the style of the element when switchClass is called and not when it runs, the animation didn't work correctly.

My fix uses the jQuery queue to evaluate the style of the element (and style difference) immediately before it is going to be used in the animation, allowing chaining and delays to work with no issue.

This is my first attempt at working on this project, so please let me know if I need to do anything else.

-Alex

…ent's style. Fixed #6244 - switchClass queues incorrectly
@Adovenmuehle
Copy link
Contributor Author

An alternative solution would be to modify $.animate to accept a function that returns an object with the style differences. This would be cleaner so jquery-ui doesn't know about the jQuery queue.

@scottgonzalez
Copy link
Member

Thanks, landed in abfa0e1 with some minor tweaks.

I mentioned the idea of passing a function to the core team, but feel free to open an enhancement ticket in their Trac.

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants