Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set css property without css transition

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 Answers

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.

like image 81
CBroe Avatar answered Sep 07 '25 19:09

CBroe