javascript - Cut a CSS transition short? -


i'm applying css transition element.

   target.style.transition = "color 10000ms ease";    target.style.color = "red"; 

under circumstances, want end state of transition reached immediately, without waiting transition finish.

if try

   target.style.transition = "color 0ms";    target.style.color = "red"; 

the current transition continues.

doing

   target.style.transition = "color 0ms";    target.style.color = "blue"; 

sets 'blue' immediately, while

   target.style.transition = "color 0ms";    target.style.color = "blue";    target.style.color = "red"; 

results in continuation of transition. (tried in both chrome , ff)

is there way stop transition?

to stop transition , reach end state immediately, use

target.style.transition = "none"; 

see demo.


Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -