jQuery event namespacing.
- August 29th, 2011
- By Ionut
- Write comment
One day I had a very interesting problem. I created a plugin with a scroll event that I had to add/remove, but I realized I can add the event but then how do I remove just my event? .. a .unbind(‘scroll’) call would remove all scroll events, not only the event added by me.
So after a little digging I found “Namespaced events” support in jQuery. What does this mean?…Well one can add a event within a specific namespace and then remove that events from that namespace.
Here is a example, in which I will add a scoll event then remove my scoll event:
Read more