javascript - 移動端css動畫播放狀態(tài)暫停在ios不起作用 animation-play-state
問題描述
移動端css動畫播放狀態(tài)暫停在ios不起作用 animation-play-state
我想點擊圖片圖片靜止,再點一下圖片繼續(xù)旋轉。在安卓手機上可以實現,但是在ios,第一次點擊圖片繼續(xù)旋轉,沒有靜止動作,反而在第二點擊的時候,圖片在第一次點擊的位置閃一下,繼續(xù)旋轉。
<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.baoyu77737.com/wenda/imgage/music.png' /> <audio autoplay='autoplay' loop='loop' id='bgm'> <source src='http://m.baoyu77737.com/wenda/music/bgm.mp3' type='audio/mpeg'> <source src='http://m.baoyu77737.com/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)疊加. 如下示例:鏈接描述
相關文章:
1. Docker for Mac 創(chuàng)建的dnsmasq容器連不上/不工作的問題2. javascript - 求賜教:網易郵箱Web端模擬登錄看信的加密參數_ntes_nnid、_ntes_nuid3. javascript - 使用angular 的ui-sref 中出現了中文參數,點擊跳轉后瀏覽器的地址欄里出現轉義后的%AE....%a%44. java - ConcurrentHashMap中的get()方法為什么可以不加鎖?5. javascript - QWebEngineView 如何爬 angular 的動態(tài)數據?6. html5 - 這個代碼顯示功能如何實現?7. javascript - 用JS 七牛上傳圖片出現文件已存在的錯誤(file exists)8. 工作近5年,3年Java Web ,近2年前端,未來何去何從?9. css3 - 圖片等比例縮放10. java - 字節(jié)流轉成字符串之后,在通過字符串轉成字節(jié)流后的文件為什么會不一樣?
