html - 在 iPhone 中首次点击时链接不起作用

标签 html css

我创建了一个使用 css 伪类的链接。如 css (:before) 中所示。在 Andriod 设备中一切正常,但在 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>

最佳答案

添加以下内容

<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>

关于html - 在 iPhone 中首次点击时链接不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45429822/

相关文章:

html - :focus::after 选择器问题

css - 图片底部的媒体标题?

css - 图片替换问题

javascript - Iframe 破坏了响应能力

html - HTML 表单元素和 POSTed 数据中的层次结构

JQuery 检测由 JS 进行更改的更改输入

html - Google 字体在 Chrome 和 Firefox 中看起来不同

javascript - 如何使用 JQuery 根据存储在第一个 TD 中的表的值隐藏存储在第二个 TD 中的图像?

php - 将特定部分 div 转换为 pdf

javascript - 带有 CSS 问题的滚动条上的粘性标题