Kevin Powell - CommunityKP-C
Kevin Powell - Community12mo ago
2 replies
Axim

Add several animations

Im trying to add several animations to an element by using JS because it's a dynamic element, the problem is the element.style.animation apparently only allows one declaration I cant add by using string concatenation like this :
js element.style.animation += "my_other_animation 1s ease-out"

I also can't declare them both (comma separated) because one is added when dragging and the other when the element is created.
Since the declaration above takes precedence the other one is overwritten so how to add several animations ? I thought maybe adding custom props for each animation and adding class with both animations declared using the custom props? but Is there a way in JS ?? thx

fiddle here : https://jsfiddle.net/dhea7rqk/1/
JSFiddle - Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle.
Was this page helpful?