$ (' img '). On ("Touchstart", function (E) {//e.preventdefault (); E.stoppropagation (); var El=this;var me=$ (This), $ ("#tip"). Text ("in Touchstart"); var t=e.touches[0]; Console.log ("touchstart!,mx,my= (", T.pagex, ",", T.pagey, "), el.x,y= (", El.offsetleft, ",", El.offsettop, ")"); Me.data ("MX", T.pagex); Me.data ("My", t.pagey); Me.data ("Ex", El.offsetleft); Me.data ("ey", el.offsettop); }). On (' Touchmove ', function (E) {e.preventdefault (); E.stoppropagation (); Console.log ("Touchmove"); var el=this;var me=$ (this); var t=e.touches[0]; var mx=parseint (me.data ("MX")), My=parseint (Me.data ("my")); var ex=parseint (Me.data ("Ex")), Ey=parseint (Me.data ("ey")); Console.log("or mx,my, new mx,my or ex,ey=", Mx,my,t.pagex,t.pagey,ex,ey) var nx=ex+t.pagex-mx, ny=ey+t. Pagey-my console.log ("Dest x,y=", NX, ",", NY) $ ("#tip"). Text ("In touch Move: "+" or mx,my, new mx,my or ex,ey= "+mx+", "+my+", "+t.pagex+", "+t.pagey+", "+ex+", "+ey+" dest x,y= "+nx+", "+ny"; Me.css ({"Left": nx+ "px", "Top": ny+ "px"}); }). On (' Touchend ', function (E) {//e.preventdefault (); E.stoppropagation (); Console.log (' touchend '); var el=this;var me=$ (this); }); $ (' img '). On (' Longtap ', function () {$.ui.actionsheet ([{text: ' BAC K ', cssclasses: ' Red ', handler:function () { Alert ("CLicked back ")}}, {text: ' Alert Hi ', cssclasses: ' Blue ', handler:function () { Alert ("Hi"); }}, {text: ' Alert Goodbye ', CSS Classes: ', Handler:function () {alert ("Goodbye"); } }] ); });
HTML5 Touche vents Drag to move & AF Actionsheet by Longtap