Monday, 30 September 2013

jQuery unbind events declared in scope

jQuery unbind events declared in scope

I've got some object that creates some event attached to document. They
are common events like mousemove, mousedown etc.
Then I want to make $(document).unbind('mousemove') and its ok but it may
crash some events created by end user of plugin or cause conflicts with
some external code.
Is it possible to remove all events declared inside some scope only?
Like:
$.fn.somePlugin = function() {
//here begins our scope
//declaring a lot of events
//some stuff
//remove events of this scope leaving other of same type untouched
}
Or is there any other way of managing groups of events?

No comments:

Post a Comment