I cheated on fancybox. I work in CakePHP Framework and I created an admin panel. This panel has several options that I upload via AJAX to the Div above the page itself.
Now, when I put the image in this div and try to use Fancybox, I get this error when I click on the image (to enlarge it):
Uncaught TypeError: Cannot call method 'hide' of undefined N I b.fn.fancybox f.event.dispatch f.event.add.h.handle.i
Now this is my ajax loader (functions.js)
$(".cmsPage").click(function() { var url = $(this).attr("href"); $.ajax({ url: url, success: function(data){ $("#admin_wrapper").fadeIn('slow'); $("#admin_content").fadeIn('slow'); $("#admin_close").fadeIn('slow'); $("#admin_content").html(data); } }); return false; });
admin_content is where the images are displayed:
#admin_content{ display:none; position:absolute; z-index:10; background-color:#fff; opacity:1; width:1000px; min-height:500px; top:1%; color:black; padding:10px; margin:10px; border:solid black 1px; border-radius:5px; }
But if I go to the page (without using ajax), it works fine.
Is there something that fancybox overloads? The error is not so clear to me. I tried everything here. But I do not use wordpress.
source share