Closed
Description
Originally reported via email:
My takeaway from reading the API regarding switchClass (http://api.jqueryui.com/switchClass/) was that the callback would be called just once, when all animation on that selector had completed. When I piled up a lot of simultaneous animation with lots of callbacks, my browser was noticeably slow.
It is the case that the callback is called once per selected element, meaning my complexity was exponential. I think a line or two about this, and perhaps an accompanying example with two elements being animated, would add much clarity.
Perhaps:
<body>
<div id="1" class="big"></div>
<div id="2" class="big"></div>
<script>
$( "div" ).click(function() {
$( this ).switchClass( "big", "blue", 1000, "easeInOutQuad", function() { console.log(this.id); } );
});
</script>
</body>
Also, of course, the other methods that this is true for as well (addClass, removeClass, toggleClass).
Thank you for the great tools and hard work!
Metadata
Metadata
Assignees
Labels
No labels