javascript - Jquery: Draggable sensibility -


i have draggable dom element using jquery.

if client clicks without moving, draggable start isn't called , acts wasn't draggable.

when clients clicks , move mouse 1 pixel away while holding down, drag starts. event triggered, classes applied etc...

is there way trigger drag start if client clicked element , moved mouse @ least 10px away instead?

note: isn't related scrolling.

code example live demo @ https://jqueryui.com/draggable/:

<style>#draggable { width: 150px; height: 150px; padding: 0.5em; }</style> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.0/jquery-ui.js"></script>  <script> $(function(){     $("#draggable").draggable();      //goal starts dragging if mouse moved more 10px }); </script>  <div id="draggable" class="ui-widget-content">     <p>drag me around</p> </div> 

it looks want use 'distance' property. http://api.jqueryui.com/draggable/#option-distance

"distance in pixels after mousedown mouse must move before dragging should start. option can used prevent unwanted drags when clicking on element."

$( "#draggable" ).draggable({   distance: 10 }); 

Comments

Popular posts from this blog

mysql - Dreamhost PyCharm Django Python 3 Launching a Site -

java - Sending SMS with SMSLib and Web Services -

python 3.5 - Pyqtgraph string in x tick -