且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

jQuery - 拖动时停止悬停事件

更新时间:2023-10-30 13:15:58

有数百种方式。

    // Image actions menu
$('ul.imglist li').hover(
  function() { 
    $(this).find('ul')
      .css('display', 'none')
      .fadeIn('fast')
      .css('display', 'block');
  },
  function() { 
    $(this).find('ul')
      .fadeOut(100); 
  }); 

应该在mouseup事件...
然后在mousedown即使你可以取消悬停事件。
通过查找绑定和解除绑定的方式

should be on mouseup event... then on mousedown even you can cancel the hover event. by the way look up binding and unbinding

但是为什么不使用draggable ui?
并节省自己一些时间努力

but why not use the draggable ui ? and save yourself some time end effort