Why do I support this incident only once and dragging it again will not work?

  node.js, question

图片描述

Why can’t my string of code trigger an event after it can only be executed once?

In fact, this has something to do with translate. I can’t find the reason yet. however, when using translate, if you drag beyond the original position, touchmove will no longer trigger, but not with translate3d.

You can try this.

var pagey1;
 var pagey2;
 var lastMove = 0;
 function load() {
 var obj=document.querySelector('.box');
 obj.addEventListener("touchstart", touch,false);
 obj.addEventListener("touchmove", touch,false);
 obj.addEventListener("touchend", touch,false);
 function touch(e) {
 console.log(e.type);
 e.target.cancelable = true;
 var e = e||window.event;
 switch(e.type) {
 case "touchstart":
 e.preventDefault();
 pagey1 = e.touches[0].pageY;
 
 console.log("start");
 break;
 case "touchmove":
 e.preventDefault();
 pagey2 = e.touches[0].pageY
 Obj.style.transform = "translated3d (0px," pagey2- pagey1 plus lastMove "plus" px, 0px) ";
 break;
 case "touchend":
 LastMove = pagey2-pagey1 plus lastmove;
 console.log("end");
 break;
 bracket
 bracket
 bracket