CSS animation doesn't restart when resetting class

后端 未结 8 1278
陌清茗
陌清茗 2020-12-01 14:58

I am using CSS shader + animation. My shader class is defined as follows:

.shader{
-webkit-filter :custom(url(v.vs) mix(url(f.fs) multiply destination-over),         


        
8条回答
  •  猫巷女王i
    2020-12-01 15:38

    According to a 2011 article on css-tricks.com, triggering a reflow in between removing and adding the class will restart the animation. Example (verbose):

    $('#holder').removeClass('shader');
    $('#holder').offsetWidth = $('#holder').offsetWidth; // triggers reflow
    $('#holder').addClass('shader'); // restarts animation
    

提交回复
热议问题