Javascript 如何在发生其他事件后禁用Jquery函数?

Javascript 如何在发生其他事件后禁用Jquery函数?,javascript,jquery,javascript-events,Javascript,Jquery,Javascript Events,当另一个事件发生时,我想禁用特定列表上的悬停事件。您可以使用该功能删除这些事件 $('#theListId').unbind('mouseenter').unbind('mouseleave'); 您还可以使用: $('#item').unbind('mouseenter mouseleave'); 这与: $('#theListId').unbind('mouseenter').unbind('mouseleave'); 你能确认这对悬停有效吗?它适用于解除绑定单击,但不适用于悬停函数。

当另一个事件发生时,我想禁用特定列表上的悬停事件。

您可以使用该功能删除这些事件

$('#theListId').unbind('mouseenter').unbind('mouseleave');
您还可以使用:

$('#item').unbind('mouseenter mouseleave');
这与:

$('#theListId').unbind('mouseenter').unbind('mouseleave');

你能确认这对悬停有效吗?它适用于解除绑定单击,但不适用于悬停函数。我已将答案更新为正确的语法。我从中获得了前面的代码,但显然您不能像那样组合unbind语句。hover不是真正的JavaScript事件,也不能像那样解除绑定。
$('#theListId').unbind('mouseenter').unbind('mouseleave');