jquery - draggable not working on touch device? -


here jsfiddle link link

$("#outer").on("mousedown", function(e) {     var inner = $("<div/>", {         class: "inner"     }).draggable().appendto("#outer");     inner.css("position", "absolute");     e.type = "mousedown.draggable";     e.target = inner[0];     inner.css("left", e.pagex);     inner.css("top", e.pagey);     inner.trigger(e);     return false; });  <div id="outer"> </div> 

can support on touch device?

bind events 'touchstart' touch devices , 'mousedown' desktop. work both devices. hence can write :

 $("#outer").bind("mousedown touchstart", function(e) {       //your code...  }); 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -