2017-10-13 136 views
1

我想下面的圖像旋轉360度及以下應用了圖像的CSS:Spining不適用於手機爲什麼?

<img src="" alt="" /> 

CSS:

.image { 
    position: absolute; 
    top: 50%; 
    left: 50%; 
    width: 120px; 
    height: 120px; 
    margin:-60px 0 0 -60px; 
    -webkit-animation:spin 4s linear infinite; 
    -moz-animation:spin 4s linear infinite; 
    animation:spin 4s linear infinite; 
} 
@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } } 
@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } } 
@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } } 

其桌面上工作良好,但無法在手機上?如果我做錯了什麼?

+1

什麼是移動瀏覽器? – Justinas

+0

.. – Sangrai

+0

將手機連接到PC,並使用普通瀏覽器devtools檢查元素。 – Justinas

回答

1

這對我來說都適用於手機和臺式機。

.loader { 
    position: absolute; 
    width: 120px; 
    height: 120px; 
    left: 0; right: 0; 
    top: 0; bottom: 0; 
    margin: auto; 
    max-width: 100%; 
    max-height: 100%; 
    overflow: hidden; 
    -webkit-animation: spin 4s linear infinite; 
    animation: spin 4s linear infinite; 
} 

@keyframes spin { 
    0% { transform: rotate(0deg); } 
    100% { transform: rotate(360deg); } 
} 
0

你的旋轉代碼可能不起作用,因爲你沒有正確編碼。動畫中存在一些問題。

SEE THE EXAMPLE

相關問題