TouchEvent无法在firefox和其他网站浏览器中运行
问题描述:
我有一个问题,在Chrome中它运行良好,但它不会在firefox中触发
I have a problem, in chrome it runs well, but it won't fire in firefox
function normalizeEvent(e){
if(e.originalEvent instanceof TouchList){
do somethings
}
}
这里是消息错误:ReferenceError:未定义TouchEvent
and here is message error: ReferenceError: TouchEvent is not defined
if(e.originalEvent instanceof TouchEvent){}
答
旧的问题,但是也许有人会在这里搜索解决方案(就像我一样)。
The old question, but maybe someone will search here the solution (as I did).
要在FF中工作,只需添加 window.TouchEvent
条件(已定义):
To get this work in FF, just add window.TouchEvent
condition (is it defined):
if(window.TouchEvent&& e.originalEvent instanceof TouchEvent){}