标签:
定义:
var touchEvents = { touchstart: "touchstart", touchmove: "touchmove", touchend: "touchend", /** * @desc:判断是否pc设备,若是pc,需要更改touch事件为鼠标事件,否则默认触摸事件 */ initTouchEvents: function () { if (isPC()) { this.touchstart = "mousedown"; this.touchmove = "mousemove"; this.touchend = "mouseup"; } } };
调用:
$(".category-item").bind(touchEvents.touchstart, function (event) { code; });
标签:
原文地址:http://www.cnblogs.com/jingyong001/p/5051745.html