问题
I would like to preload the next image in a Fancybox2 gallery, but I don't know if that's possible. I know how to preload and image by creating a new Image() object and setting the src attribute, but I don't know which Fancybox callback should I use. Does anyone know which Fancybox event is triggered when it starts or it finishes displaying the current image?
So the answer is: simply use 2.0.5 and above to take advantage of the preload
setting, which preloads 3 images by default.
回答1:
fancyBox2 since v2.0.5 has an option preload
- number of images to preload and it preloads 3 images by default
回答2:
Fancybox 2 already has image preloading built in. Search the source code for "preload" and you'll see how it works.
The preloader is triggered internally after beforeShow is fired in _beforeShow.
来源:https://stackoverflow.com/questions/9496982/preload-next-image-in-fancybox2-gallery