1.使用 in 运算符,检测对象中是否存在事件
var div = document.createElement('div'),//是否支持触摸事件supportTouch = 'ontouchstart' in div,//是否支持方向转换事件supportOtc = 'onorientationchange' in window;
1.使用 in 运算符,检测对象中是否存在事件
var div = document.createElement('div'),//是否支持触摸事件supportTouch = 'ontouchstart' in div,//是否支持方向转换事件supportOtc = 'onorientationchange' in window;