javascript - 移動端css動畫播放狀態(tài)暫停在ios不起作用 animation-play-state
問題描述
移動端css動畫播放狀態(tài)暫停在ios不起作用 animation-play-state
我想點(diǎn)擊圖片圖片靜止,再點(diǎn)一下圖片繼續(xù)旋轉(zhuǎn)。在安卓手機(jī)上可以實(shí)現(xiàn),但是在ios,第一次點(diǎn)擊圖片繼續(xù)旋轉(zhuǎn),沒有靜止動作,反而在第二點(diǎn)擊的時(shí)候,圖片在第一次點(diǎn)擊的位置閃一下,繼續(xù)旋轉(zhuǎn)。
<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.cgvv.com.cn/wenda/imgage/music.png' /> <audio autoplay='autoplay' loop='loop' id='bgm'> <source src='http://m.cgvv.com.cn/wenda/music/bgm.mp3' type='audio/mpeg'> <source src='http://m.cgvv.com.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 失效.
你可以把狀態(tài)疊加. 如下示例:鏈接描述
相關(guān)文章:
1. javascript - vue 父子組件傳遞數(shù)據(jù)2. docker images顯示的鏡像過多,狗眼被亮瞎了,怎么辦?3. dockerfile - 我用docker build的時(shí)候出現(xiàn)下邊問題 麻煩幫我看一下4. docker start -a dockername 老是卡住,什么情況?5. javascript - 怎么實(shí)現(xiàn)讓 div 里面的 img 元素 中心居中, 如下示例圖6. javascript - CSS圖片輪播顯示問題7. javascript - vue-router怎么不能實(shí)現(xiàn)跳轉(zhuǎn)呢8. python 字符串匹配問題9. docker不顯示端口映射呢?10. javascript - 自執(zhí)行函數(shù)是當(dāng)加載到這個(gè)js就執(zhí)行函數(shù)了嗎
