Victor
Victor

Reputation: 3698

jquery not unbinding a "resize" bind done in a plugin

I have a plugin that does:

$(window).resize(setOverlayHeight) .resize(setSelfPosition)

and I cant remove it in the main js code...

I have tried:

$(window).off("resize", "setOverlayHeight");

and

$(window).unbind('resize', 'setSelfPosition');

http://jsfiddle.net/VVqFn/3/

Have I done anything wrong?

Upvotes: 0

Views: 199

Answers (1)

PSL
PSL

Reputation: 123739

You need to pass the function reference, not a string.

$(window).off("resize", setOverlayHeight);

In order to remove all event bindings on window you can just do:

$(window).off();

Upvotes: 2

Related Questions