-webkit-animation-play-state not working on iOS 8.1 (probably lower too)

后端 未结 1 1698
太阳男子
太阳男子 2020-12-19 05:52

I have an animation running on page load and with javascript I add a class containing the

-webkit-animation-play-state:paused;

Working fin

相关标签:
1条回答
  • 2020-12-19 06:47

    Workaround approach for iOS 8-9 Safari that use -webkit-animation: none !important; instead of -webkit-animation-play-state:paused; This approach is for GWD, but can apply otherwise

    1. Don't use Pause event in GWD (Google Web Designer)
    2. Create normal event that calls a javascript function, set "-webkit-animation: none !important;" to the <div> (you can add/remove css class)

    CSS Style

    .no-animation {
      -webkit-animation: none !important;
    }
    

    Javascript

    div.className = div.className + " no-animation";
    
    1. To resume, remove CSS class

    Javascript

    div.className = div.className.replace("no-animation", '');
    
    1. Please note that when remove/pause animation, it will go back to frame 0 (00:00 s), so you may need to calculate the current opacity/position for the div

    http://jsfiddle.net/duchuy/pczsufL9/

    0 讨论(0)
提交回复
热议问题