Stopping specific jQuery animations -


i have multiple animations on single object, , need stop specific animation rather of them. doesn't .stop() method can this.

for instance, when animating opacity , width simultaneously, may need cancel opacity animation while still completing width animation. seem not possible, hoping knows trick or api call i'm missing.

note: i'm not talking queued animations, i'm looking animate multiple attributes @ same time ability stop of attribute animations after have started

i hate guy answers own question (thanks detailed responses , putting brain power it!) have found direct answer. apparently there parameter .animate() method called "queue" defaults true can set false in order have animation take place immediately.

this means setting queue false can run multiple animations using separate calls without having wait previous 1 finish. better yet, if try run animation property being animated, second override first. means can stop property's animation "animating" current value duration of 0, using queue "false".

an example:

$myelement = $("#animateelement"); $myelement.animate({width: 500}, {duration: 5000}); $myelement.animate({height: 500}, {duration: 5000, queue: false}); // ... wait 2 seconds ... $myelement.animate({width: $myelement.width()}, {duration: 0, queue: false}); 

another option suggested gracious jquery contributor responded enhancement request. takes advantage of ability use step function on animation (step functions called @ every point in animation, , can manipulate animation parameters based on whatever criteria want). although have solved issue, felt far more dirty "queue: false" option.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -