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
Post a Comment