Modernizr.touch在Firefox浏览器上返回true [英] Modernizr.touch returns true on firefox browser

查看:197
本文介绍了Modernizr.touch在Firefox浏览器上返回true的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经写了一个和平的代码来获得基于触摸和非触摸的事件。它的所有其他浏览器和设备,但火狐。默认FF返回 true

  var thumbsEvent,isTouch = Modernizr。触摸; //检测触摸
if(isTouch){
thumbsEvent ='click'; //在触摸界面上,单击
}
else {
thumbsEvent ='mouseover '; //在非触摸表面上,mouseover
}

有没有办法管理这个问题。



示例小提琴 我们真的很抱歉。


解决方案

> Modernizr.touch 在尚未发布的版本3.0中已被重命名为 Modernizr.touchevents ,因为它是一个更准确的描述的检测。基本上,所有这些检测正在检查触摸事件的存在,如果发现触摸事件返回true。如果您启用开发人员工具,桌面Chrome会执行相同的操作。这只是意味着您的笔记本电脑上的Firefox版本报告了触摸事件的支持,原因有几个。

I have written a peace of code to get the event based on touch and non-touch. Its working all other browsers and devices, but Firefox. Default FF return the true.

var thumbsEvent, isTouch = Modernizr.touch; // detect the touch
if(isTouch){
   thumbsEvent = 'click';//on touch surface, click
}
else {
   thumbsEvent = 'mouseover';//on non touch surface, mouseover
}

Is there a way to manage this issue.

Example fiddle

解决方案

On behalf of Modernizr - We're really sorry about this.

Modernizr.touch has been renamed Modernizr.touchevents in the yet-to-be-released version 3.0, as it is a far more accurate description of the detect. Basically, all this detect is doing is checking for the existence of touch events, and returning true if they are found. Desktop chrome does the same thing if you enable developer tools. It just means that your version of firefox on your laptop is reporting support of touch events, for several possible reasons.

这篇关于Modernizr.touch在Firefox浏览器上返回true的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆