I am developing my own lightbox kind of jquery plugin. Everything works but I want to hide the loaded content until the images have loaded in the browser from the AJAX call. I found a similar post and I am using the following script but the setTimeout function is what reveals the content and not the .load function. Am I trying to achieve the impossible?
$.ajax({
url: 'meet/'+ pLoad + '.html',
success: function(data) {
var imageCount = $(data).filter('img').length;
var imagesLoaded = 0;
$(data).hide()
.appendTo('#zoom_inner')
.filter('img')
.load( function() {
++imagesLoaded;
if (imagesLoaded >= imageCount) {
$('#zoom_inner').children().show();
}
});
setTimeout( function() { $('#zoom_inner').children().show() }, 5000 );
}
});