css :active 伪类 Safari Mobile 无效问

2017-01-11  本文已影响111人  闷油瓶小张

问题出现原因

https://developer.mozilla.org/en-US/docs/Web/CSS/:active 上关于该伪类有如下说明:

[1] By default, Safari Mobile does not use the :active state unless there is a touchstart event handler on the relevant element or on the <body>
.

问题解决方案

<body ontouchstart=""></body>
<script> document.body.addEventListener('touchstart',function(){},false);</script>
上一篇 下一篇

猜你喜欢

热点阅读