2017-08-01 80 views
0

我創建了一個使用css僞類的鏈接。正如在CSS中看到的(:之前)。在Andriod設備中一切都很好,但在iPhone中,它正在進行第二次點擊Why ...?如果有任何解決方案,請幫助我。鏈接無法在iPhone中進行第一次點擊

.link{float:left;} 
 
.link a { 
 
    color: #000; 
 
    font-size: 15px; 
 
    font-weight: 400; 
 
    padding: 10px; 
 
    display: inline-block; 
 
    border: 1px solid #b6fe54; 
 
    -webkit-transition: all .5s ease-in-out; 
 
    -moz-transition: all .5s ease-in-out; 
 
    -o-transition: all .5s ease-in-out; 
 
    transition: all .5s ease-in-out; 
 
    position: relative; 
 
} 
 
.link a:before { 
 
    position: absolute; 
 
    content: ""; 
 
    width: 0px; 
 
    background: #b6fe54; 
 
    left: 0px; 
 
    top: 0px; 
 
    height: 100%; 
 
    z-index: -1; 
 
    -webkit-transition: all .5s ease-in-out; 
 
    -moz-transition: all .5s ease-in-out; 
 
    -o-transition: all .5s ease-in-out; 
 
    transition: all .5s ease-in-out; 
 
} 
 
.link a:hover:before { 
 
    width: 100%; 
 
}
<div class="link"><a href="https://www.google.co.in" target="_blank">Learn More</a></div>

+0

工作的呢? https://jsfiddle.net/xoe3cwgd/ –

回答

1

添加以下

<script> 
var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; 
if(!iOS) 
    document.write('\x3Cstyle>.link a:hover:before {width: 100%;}\x3C/style>'); 
</script> 
+0

感謝您的回答,但它會停止其動畫。 –

+1

@chandershekhar是否解決了iPhone問題?除非您使用媒體查詢或其他東西,否則您必須選擇在iPhone或桌面上工作。 – William

+0

我要這個動畫也 –