手持上click事件的響應(yīng)速度遠遠不如touchstart。但是僅僅寫touch事件很不方便web端開發(fā)測試,所以下邊的判斷很有必要。###
<pre>
var isSupportTouch = "ontouchend" in document ? true : false,
touchEv = isSupportTouch ? 'touchstart' : 'mousedown',
touchEndEv = isSupportTouch ? "touchend" : 'mouseup';
</pre>
另外:
<pre>
var isSupportTouch = "ontouchend" in document ? true : false,
touchEv = isSupportTouch ? 'touchstart' : 'click';
</pre>
用起來就很方便啦
<pre>
$obj.on(touchEv,function(){
\事件
});
</pre>