Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 用手指沿着路径执行代码_Jquery - Fatal编程技术网

Jquery 用手指沿着路径执行代码

Jquery 用手指沿着路径执行代码,jquery,Jquery,我设置了以下页面,当用户触摸开始、触摸移动和触摸结束时检测坐标。我正在尝试构建某种游戏,在这种游戏中,用户必须画一颗星星,以便执行某些代码。我怎样才能检测到某些代码何时被传递了11个点: 这是迄今为止的代码: touchMe[0].ontouchstart = function(e) { log.html("Touch Start"); var touche= e.touches[0]; //instead of e.clientX, in touch

我设置了以下页面,当用户触摸开始、触摸移动和触摸结束时检测坐标。我正在尝试构建某种游戏,在这种游戏中,用户必须画一颗星星,以便执行某些代码。我怎样才能检测到某些代码何时被传递了11个点:

这是迄今为止的代码:

touchMe[0].ontouchstart = function(e) {        
    log.html("Touch Start");
    var touche= e.touches[0]; 
    //instead of e.clientX, in touch event we have to acess like this    e.touches[0].clientX.
    log.append("X :" + touche.clientX + "Y :" +touche.clientY);
    log.append("</br>");
}    

touchMe[0].ontouchmove = function(e) {       
   log.html("Touch Move");
    var touche= e.touches[0]; 
     //instead of e.clientX, in touch event we have to acess like this    e.touches[0].clientX.
    log.append("X :" + touche.clientX + "Y :" +touche.clientY);
    log.append("</br>");
}  

touchMe.bind("touchend", function(e) {
  log.html("LOG");
});
touchMe[0]。ontouchstart=函数(e){
html(“触摸启动”);
var touche=e.touchs[0];
//在touch事件中,我们必须像这样访问e.touch[0].clientX,而不是e.clientX。
log.append(“X:+touche.clientX+”Y:+touche.clientY);
log.append(“
”); } touchMe[0]。ontouchmove=函数(e){ html(“触摸移动”); var touche=e.touchs[0]; //在touch事件中,我们必须像这样访问e.touch[0].clientX,而不是e.clientX。 log.append(“X:+touche.clientX+”Y:+touche.clientY); log.append(“
”); } touchMe.bind(“touchend”,函数(e){ html(“log”); });
演示