We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
桌面浏览器不支持 createTouch 方法,Chrome 开启模拟也会报错:
Uncaught TypeError: document.createTouch is not a function
但是可以创建 UIEvent 来模拟 touch 事件
var t = document.getElementById('t'); t.addEventListener('touchstart',function(e){ console.log(e.touches) },false); function fire (element, event) { var e = new UIEvent(event, { bubbles: true, cancelable: false, detail: 1 }) e.touches = [{pageX: 0, pageY: 0}] element.dispatchEvent(e); } fire(t, 'touchstart')
Chrome firefox 和 safari 都会触发 touchstart 事件,IE不确定,组件里面应该可以做到降级处理
The text was updated successfully, but these errors were encountered:
欢迎 pr
Sorry, something went wrong.
这项目里面代码有点太复杂,我搞了一个小组件 https://github.com/chemzqm/touch-simulate 来测试touch事件
No branches or pull requests
桌面浏览器不支持 createTouch 方法,Chrome 开启模拟也会报错:
Uncaught TypeError: document.createTouch is not a function
但是可以创建 UIEvent 来模拟 touch 事件
Chrome firefox 和 safari 都会触发 touchstart 事件,IE不确定,组件里面应该可以做到降级处理
The text was updated successfully, but these errors were encountered: