DEV Community

Ankit Kanojia
Ankit Kanojia

Posted on

Answer: How can I set a CSS keyframes in Javascript?

let me share with you two snippets, one is using CSS + javascript and another is only using javascript, you can use whatever preferred to you. Hope its helpful to you.

WITH JAVASCRIPT

let dynamicStyles = null;

function addAnimation(body) {
  if (!dynamicStyles) {
    dynamicStyles = document.createElement('style');
</p>



?signin=true

Top comments (0)