1. 程式人生 > >移動端ios中active無效

移動端ios中active無效

方法一:body新增ontouchstart

<body ontouchstart="">

方法二:js給 document 繫結 touchstart 或 touchend 事件

<style>
a {
  color: #000;
}
a:active {
  color: #fff;
}
</style>
<a herf=foo >bar</a>
<script>
  document.addEventListener('touchstart',function(){},false);
</script>