开发者

drag element to specific div

开发者 https://www.devze.com 2023-01-30 13:41 出处:网络
want to drag element to specific div and if not dragged to this div will comeback (revert) using jQue开发者_高级运维ry UI<div id=\"draggable\" style=\"width: 50px; height: 50px; border: solid 1px #

want to drag element to specific div and if not dragged to this div will comeback (revert) using jQue开发者_高级运维ry UI


<div id="draggable" style="width: 50px; height: 50px; border: solid 1px #000;">Drag me!</div>
<div id="droppable" style="width: 150px; height: 150px; border: solid 1px #000;">Drop here!</div>

<script type="text/javascript">
 $( "#draggable" ).draggable({ revert: true });
 $( "#droppable" ).droppable({
  accept: "#draggable",
  drop: function( event, ui ) {
   // the draggable is dropped
  }
 });
</script>
0

精彩评论

暂无评论...
验证码 换一张
取 消