Load JavaScript from a post that’s loading into Fancybox via ajax

You need to apply any javascript after the content is loaded. See the Callbacks tab in documentation.

$(".fancybox").fancybox({
    afterLoad: function(current, previous){
        // initialize your js stuff  
    }
});