I know there is a way to call fancybox manually with a string of html like so:
$.fancybox("<div>foo</div>")
However, i want to instead pass a jQuery object to the fancybox so i can retain things like .data() and click() events i have already added:
var $fooObj = $("div.foo").data("foo","bar");
$.fancybox($fooObj);
Is this possible somehow?
You just need to set it as the
contentproperty in the options you pass into$.fancybox(), like this:You can test it out here.