jquery를 사용하여 드래그 가능한 DOM 요소가 있습니다.Jquery : 드래그 가능한 감성
클라이언트가 이동하지 않고 클릭하면 드래그 할 수있는 시작이 호출되지 않고 드래그 할 수없는 것처럼 작동합니다.
클라이언트가 클릭하고 1 픽셀 떨어진 상태에서 드래그하면 드래그가 시작됩니다. 이벤트가 트리거되고 클래스가 적용됩니다.
클라이언트가 요소를 클릭하고 마우스를 적어도 10 픽셀 이상 멀리 이동 한 경우에만 드래그 시작을 트리거 할 수 있습니까?
참고 : 이것은 스크롤과 관련이 없습니다. 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 is to only starts dragging if mouse moved more than 10px
});
</script>
<div id="draggable" class="ui-widget-content">
<p>Drag me around</p>
</div>
공유 할 코드가 있습니까? –
질문에 코드를 추가했습니다. – RainingChain
http://api.jqueryui.com/draggable/#option-distance –