OK, just for fun and based on imran-a's comment at this GitHub issue, here is your hacked solution :
$(".fancybox").fancybox({
loop: false,
beforeLoad: function () {
if ((this.index == this.group.length - 1) && !done) {
ajaxGetNextImages();
done = true;
this.group.push(
{ href: "images/04.jpg", type: "image", title: "Picture 04", isDom: false },
{ href: "images/05.jpg", type: "image", title: "Picture 05", isDom: false },
{ href: "images/06.jpg", type: "image", title: "Picture 06", isDom: false }
); // push
} // if
} // beforeLoad
}); // fancybox
NOTICE that apart from calling ajaxGetNextImages()
(which places the new images in the document flow) I had to push (manually) the new images inside the fancybox's group.
Is not a perfect solution but it works, see DEMO HERE; you will see three thumbnails at page load. Once you open fancybox and navigate to the last item, three more thumbnails will be added to the document as well as the 3 corresponding images to the fancybox gallery.
Also notice that you have to initialize var done = false;
at the begining of your script.
BTW, forget about the function loadFancybox()
,no needed.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…