I am trying to check if a fancybox has been loaded already. If so then I run an ajax script to put content inside.
If not I open a fancybox iframe and it fetches content.
Here is the code:
if ($('div#fancybox-frame:empty').length >0) {
alert('it is empty');
$.fancybox({
'width': '80%',
'height': '80%',
'autoScale': true,
'transitionIn': 'fade',
'transitionOut': 'fade',
'type': 'iframe',
'href': '/show_photo'
});
}
else{
alert('it is full');
$.ajax({
type: "GET",
url: "/show_photo",
success: function(data){
cropping_arrived();
}
});
}
});
It always returns that it is full even when I know there is not fancybox open.
Any ideas?