且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用触摸屏在Windows 8上的Chrome中检测触摸事件

更新时间:2023-11-21 14:42:40

要使鼠标和触摸事件在带触摸屏的Windows 8 chrome上协同工作,我必须:

To get mouse and touch events working together on windows 8 chrome with touchscreen i had to:

1.在一个元素"touchstart.owl mousedown.owl"上添加两个事件

1.add two events on one element "touchstart.owl mousedown.owl"

2.选中"event.touches":

2.check "event.touches":

if(event.touches){
    x = event.touches[0].pageX
    y = event.touches[0].pageY
} else {
    x = event.pageX
    y = event.pageY
}