我有一个类似的插件
$.fn.mycoolplugin
绑定(bind) mousemove到文档就像
$(document).("mousemove", function() {
//bunch of stuff
});
在选择器上调用该函数之后
$('.myclass').mycoolplugin();
我如何解除绑定(bind),因为 mousemove绑定(bind)到文档,我的代码中的其他内容使用 mouseenter和mouseleave ?
请您参考如下方法:
您可以通过调用.unbind来取消绑定(bind)任何处理程序:
$(document).unbind("mousemove");
这将解除所有 mousemove 处理程序与 document 的绑定(bind)。请注意,这样做可能会破坏插件的功能(存在破坏将 mousemove 处理程序添加到 document 的任何其他代码/插件的风险)。
