ios伪类active兼容问题

在iOS系统的移动设备中,需要在按钮元素或body/html标签上绑定一个touchstart事件才能激活:active状态。比如:

<body ontouchstart="">
...
</body>

或者js给 document 绑定 touchstart 或 touchend 事件:

document.body.addEventListener('touchstart', function () {});  

对于PC端,将touchstart换成mouseover即可。

posted @ 2020-04-08 15:30  shetoutou  阅读(374)  评论(0编辑  收藏  举报