点击事件是html开发中最常用的事件,而jquery里面有click,mousedown,mouseup,touchstart,touchend等事件函数可以调用。
在mobile上,必须要用touchstart,可以用以下函数进行判断。
function detectmob() { if( navigator.userAgent.match(/Android/i) || navigator.userAgent.match(/webOS/i) || navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPad/i) || navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/BlackBerry/i) || navigator.userAgent.match(/Windows Phone/i) ) { return true; }else{ return false; } }
原文:http://www.cnblogs.com/maomaoroc/p/3539633.html