How to destroy Fancybox?

Martin picture Martin · Mar 1, 2013 · Viewed 11.6k times · Source

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

dfsq picture dfsq · Mar 1, 2013

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/