Unbind jQuery plugin?

I have a type plugin

$.fn.mycoolplugin

which links mousemoveto a document of type

$(document).("mousemove", function() {
    //bunch of stuff
});

after calling the function on the selector

$('.myclass').mycoolplugin();

How would I untie this because it is mousemoveattached to a document, and other elements in my code use mouseenterand mouseleave?

+5
source share
2 answers

You can untie any handler by calling .unbind:

$(document).unbind("mousemove");

This will untie all handlers mousemovefrom document. Please note that this may violate the functionality of the plugin (with the risk of cracking any other code / plugin that the handler adds mousemoveto document).

0
source

, , :

  • , (, mousemover ..).
  • , .
  • , anoymous. . , , :

    $(document).bind('mousemove', myFuncDelegate);

, , :

 $(document).unbind('mousemove', myFuncDelegate);

, . . http://api.jquery.com/unbind/.

, , unbind.

0
source

All Articles