javascript - 移動端css動畫播放狀態暫停在ios不起作用 animation-play-state
問題描述
移動端css動畫播放狀態暫停在ios不起作用 animation-play-state
我想點擊圖片圖片靜止,再點一下圖片繼續旋轉。在安卓手機上可以實現,但是在ios,第一次點擊圖片繼續旋轉,沒有靜止動作,反而在第二點擊的時候,圖片在第一次點擊的位置閃一下,繼續旋轉。
<style type='text/css'>#wls .musicCon{width: 35px;height: 35px;position:fixed;top:15px;right:15px;z-index: 9999; } img.rotate{ animation:spin 4s infinite linear; -moz-animation:spin 4s infinite linear; -webkit-animation:spin 4s infinite linear;-webkit-animation-play-state: running; -moz-animation-play-state: running; animation-play-state: running; -ms-animation-play-state: running; -o-animation-play-state: running;}@keyframes spin { 0%{ transform:rotate(0deg); } 100%{ transform:rotate(360deg); }}@-o-keyframes spin { 0% {-o-transform: rotate(0deg); } 100%{ -o-transform:rotate(360deg); }}@-moz-keyframes spin { 0% {-moz-transform: rotate(0deg); } 100%{ -moz-transform:rotate(360deg); }}@-webkit-keyframes spin { 0% {-webkit-transform: rotate(0deg); } 100%{ -webkit-transform:rotate(360deg); }} img.pauseWalk { animation:spin 4s infinite linear; -moz-animation:spin 4s infinite linear; -webkit-animation:spin 4s infinite linear; -webkit-animation-play-state: paused; -moz-animation-play-state: paused; animation-play-state: paused; -ms-animation-play-state: paused; -o-animation-play-state: paused;}</style><body id='wls'> <img src='http://m.lshqa.cn/wenda/imgage/music.png' /> <audio autoplay='autoplay' loop='loop' id='bgm'> <source src='http://m.lshqa.cn/wenda/music/bgm.mp3' type='audio/mpeg'> <source src='http://m.lshqa.cn/wenda/music/bgm.ogg' type='audio/ogg'></audio><script> var num=1; $('#wls .musicCon').bind('click',function(){if(num==1){ $(this).removeClass('rotate'); $(this).addClass('pauseWalk'); $('#bgm')[0].pause(); num++; return num;}else{ $(this).removeClass('pauseWalk'); $(this).addClass('rotate'); $('#bgm')[0].play(); num=1; return num;} })</script></body>
問題解答
回答1:iOS 上 animation-play-state 失效.
你可以把狀態疊加. 如下示例:鏈接描述
相關文章:
1. objective-c - 從朋友圈跳到我的APP 如何實現?2. 網頁爬蟲 - python爬蟲用BeautifulSoup爬取<s>元素并寫入字典,但某些div下沒有這一元素,導致自動寫入下一條,如何解決?3. javascript - html 中select如何修改樣式,鼠標懸浮時改變option樣式,有沒有插件啊4. HTML5禁止img預覽該怎么解決?5. 請教一個python字符串處理的問題?6. 如何分別在Windows下用Winform項模板+C#,在MacOSX下用Cocos Application項目模板+Objective-C實現一個制作游戲的空的黑窗口?7. javascript - vue+iview upload傳參失敗 跨域問題后臺已經解決 仍然報403,這是怎么回事啊?8. javascript - vscode alt+shift+f 格式化js代碼,通不過eslint的代碼風格檢查怎么辦。。。9. 怎么可以實現在手機瀏覽器看到鏈接的title屬性,就是鼠標放上去會有一個tip效果的10. 百度地圖api - Android 百度地圖 集成了定位,導航 相互的jar包有沖突?
