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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With