Martin Martin - 1 month ago 40
Javascript Question

How to destroy Fancybox?

I'm trying to destroy Fancybox. I haven't found any method to do it in documentation. How to destroy it after it was initialized?

This doesn't work:

$("a").unbind('fancybox').unbind('click');


Testing code: http://jsfiddle.net/martinba/yy3cw/2/

I use current version 2.1.4.

Answer

In order to unbind fancybox you have to unbind events under fb-start namespace from document:

$(document).unbind('click.fb-start');

Though, I don't know why developer made it so unobvious.

http://jsfiddle.net/dfsq/yy3cw/16/