4

I have an element for which I need to toggle the opacity. Sometimes I want to transition the opacity, and sometimes I do not. Is there an easy way to reset the property without the transition using JavaScript some of the time without turning the transition off?

1
  • why dont you just manage the opacity with js instead? Commented Feb 6, 2014 at 4:51

1 Answer 1

6

Is there an easy way to reset the property without the transition using JavaScript some of the time without turning the transition off?

Not that I know of. A transition occurs when the property it is set on changes – how that change occurs, does not matter.

But there is an easy way of turning it off – apply the transition via a class, and then remove that class dynamically when you want to change the property value without transition.

Sign up to request clarification or add additional context in comments.

1 Comment

I was hoping to avoid that, but thanks for confirming.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.