Using JQuery to set CSS Keyframe

前端 未结 2 560
攒了一身酷
攒了一身酷 2020-12-15 10:06

I\'m trying to determine the height of a div which is dynamic depending on the size of the text. I was trying to set this dynamically within the CSS as my origi

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-15 10:24

    I managed to achieve activating a keyframe by creating a class with the name of the keyframe defined

    .add_keyframe{
      animation: shrink 5s
    }
    

    and then add this using jquery

    $('#whatever').addClass('add_keyframe');
    

    Once the class is added your keyframe should run.

提交回复
热议问题