Reputation: 4214
Wish you all a Happy New Year folks!
I just wanted to ask if there was any way to stop jquery animation for ALL CHILD NODES of an element? I mean lets say if I have a below html structure in a document and I have applied different animations to all the div's inside the container - some also in queue=false etc.
<div id="container">
<div id="element-1"></div>
<div id="element-2"></div>
<div id="element-3"></div>
<div id="element-4"></div>
<div id="element-5"></div>
</div>
Is there a way to stop all animations for all elements inside the div instantly? Well okay, one would recall the below code immediately
$('#element-1, #element-2, #element-3, #element-4, #element-5').stop(true);
and it should stop all elements - instantly. And if we try
$('#element-1, #element-2, #element-3, #element-4, #element-5').stop(true, true);
The elements should jump to end result - surely not working for me. Kind of what is required but what if I have 300 elements animating at the same instant - I surely cannot apply the above method eh!
I was seeking something like
$('#container').stop(true,true);
Is some tweak possible?
Upvotes: 3
Views: 4004
Reputation: 2031
You can select all elements inside wrapper and stop then stop them. For your html this one should work:
$('#container').find('*').stop(true, true);
Upvotes: 4