My contemplations and diurnal novelties are publicized here

How you apply and remove event handlers may also cause problems that can be really hard to troubleshoot. E.g if you had attached a function to the window.resize event. Calling the following script will remove all window.resize handlers:


jQuery provides an easy way to avoid this: Namespaced Events. When binding a function to an event, simply add a namespace:

$(window).bind(‘resize.mynamespace’, function () {

// Do something useful


Now if you need to unbind the function from the event, you can do it safely without affecting other scripts that use the same event:

$(window).unbind(‘resize.mynamespace ‘);



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: