mozilla开发社区上有 :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>.

 

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

document.body.addEventListener('touchstart', function () { //...空函数即可 });  

 

将上述事件监听代码加上后,Safari Mobile上就可以看到按钮按下后的切换效果了。

相关文章:

  • 2022-12-23
  • 2022-02-25
  • 2022-01-11
  • 2022-01-12
  • 2022-01-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-08
  • 2022-12-23
相关资源
相似解决方案