// 绑定鼠标事件
$(".p5-3")[0].addEventListener('touchstart', function(evt) {
var touch = evt.touches[0];
thisX = touch.pageX-$(".p5-3").width()/2;
thisY = touch.pageY-$(".p5-3").height()/2;
$(".p5-3").css({
'left':thisX,
'top':thisY
})
});
$(".p5-3")[0]. addEventListener('touchmove', function(evt) {
var touch = evt.touches[0];
thisX = touch.pageX-$(".p5-3").width()/2;
thisY = touch.pageY-$(".p5-3").height()/2;
$(".p5-3").css({
'left':thisX,
'top':thisY
})
console.log(thisX,thisY)
});
$(".p5-3")[0].addEventListener('touchend', function(evt) {
var touch = evt.changedTouches[0] ? evt.changedTouches[0] : evt.touches[0];
thisX = touch.pageX-$(".p5-3").width()/2;
thisY = touch.pageY-$(".p5-3").height()/2;
$(".p5-3").css({
'left':thisX,
'top':thisY
})
});