手机端触摸位置获取
function touch(event) { var event = event || window.event; switch (event.type) { case "touchstart": console.log(event.touches[0].clientX + "," + event.touches[0].clientY); break; case "touchend": console.log(event.changedTouches[0].clientX + "," + event.changedTouches[0].clientY); break; case "touchmove": event.preventDefault(); console.log(event.touches[0].clientX + "," + event.touches[0].clientY); break; } }
不忘初心,方得始终