Preload next image in Fancybox2 gallery

守給你的承諾、 提交于 2019-12-11 18:03:59

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!