解决ios不支持按钮:active伪类的方法
2017-12-07 17:03
441 查看
mozilla开发社区上有 :active 不起作用的答案:
在iOS系统的移动设备中,需要在按钮元素或body/html上绑定一个touchstart事件才能激活:active状态。
将上述事件监听代码加上后,Safari Mobile上就可以看到按钮按下后的切换效果了。
[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上就可以看到按钮按下后的切换效果了。
相关文章推荐
- 解决scroll在ios上卡顿问题和兼容ios不支持:active伪类情况
- jquery easyui-linkButton获取和设置按钮text并且解决火狐不支持innerText的方法
- 移动端:active伪类无效的解决方法
- iOS开发两个距离较近的按钮同时触发事件的解决方法
- IOS 开发两个按钮(button)很近的时候同时触发事件解决的方法(setExclusiveTouch)
- 【Android进阶】Android里webview不支持input file的解决方法(上传按钮点击失效的原因)
- 【Android进阶】Android里webview不支持input file的解决方法(上传按钮点击失效的原因)
- RAD Studio D10发布IOS TestFlight不支持外部测试的解决方法
- iOS 解决自定义导航栏返回按钮 系统右滑返回手势失效问题 最简单方法
- IOS系统对position:fixed支持不好的解决方法
- iOS解决按钮短时间内多次点击只触发一次事件方法
- Ios下解决libzbar.a不支持armv7s的方法
- iOS解决按钮短时间内多次点击只触发一次事件方法(开始写博客)
- 移动端:active伪类无效的解决方法
- IOS 使用自定义手势屏蔽按钮解决方法/UITapGestureRecognizer屏蔽Button
- 手机端点击按钮阴影 ios输入框阴影解决方法
- iOS下解决libzbar.a不支持armv7s的方法
- 越狱iOS代码不再支持system()函数的解决方法
- 在iphone上active伪类无效解决方法
- 解决IE7以下版本不支持无A状态伪类的几种方法