JQuery 上的 Dragstop

Dragstop on JQuery

我使用 JQuery 来识别 dragstart 和 dragstop。 dragstart 事件工作正常,但 dragstop 事件没有。 这是我写的代码-

$('img').on('dragstart', function (event) {
 $(function() {        
            $("#toolbar").animate({width:'toggle'},0);      
  });
  
});
$('img').on('dragstop', function (event) {
  alert("hi"); 
});

谢谢。

使用dragend事件! 拖动操作结束时触发

所有事件请参考HTML Drag and Drop API

$('#image').on('dragstart', function(event) {
  console.log('dragstart');
});
$('#image').on('dragend', function(event) {
  console.log('dragend');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<img src="https://www.repeatsoftware.com/Help/img3C.gif" id="image" height="100px" width="100px" />