Safer event handling with jQuery namespaced events | 456 Berea Street

“Recently I was working on a project where I had attached a function to the window.resize event. But my function simply would not run, and it took me forever to figure out why. The culprit turned out to be a jQuery plugin that also attached a function to window.resize when it was triggered (in this case to display a dialog). Problem is that when the dialog was dismissed, the script removed all window.resize handlers […]”.

Global events are similar to global variables: avoid them every time you can.


Recently saved from the net oblivion