Is it possible to switch on and off a collapse directives animation?
-
21-12-2019 - |
Question
I have a number of collapse
directives in an app and i'd like to be able to individually switch their animation on and off (to 'force' them open or closed), depending on specific state. I've looked at the source and can't see where i'd be able to hook into the directive to achieve this. Or am i missing something obvious?
The only solution i can see at the moment, is duplicating the whole directive and modifying the link
function to allow for a second attribute to be watched that would determine if animation is used or not.
Solution
AFAIK, the angular animation is based on CSS transition, so you could disable animations by add some CSS properties to the element.
May be define a noanimate
class like this:
.noanimate {
transition: none !important;
}
then you could add/remove the noanimate
class to the element when you want to disable/enable the animation.
Hope this helps.