I don't have the exact code in a useful form, but I can explain the structure. I did something very similar in jQuery - although I would say that it is not as much jQuery as Javascript. Here are the basics of what I did ...
Create a function that preloads the image. The way to do this in Javascript is to simply create an image element, for example:
`function preloadAnImage(src) { var i = new Image(1020, 492); i.src = src; }`
Create a list of images, for example. imagesToPreloadIndex = ['image1.jpg','image2.jpg'... ];
Create a function that works with this queue, for example:
function preloadNextImage() { preloadAnImage(imagesToPreload.pop()); if (imagesToPreloadIndex.length > 0) { setTimeout(preloadNextImage, 300); } }
It gives you a framework.
You will need synchronization with the actual image display. This works great as long as everything goes right. Then you need to decide what to do if you are lagging behind in your loading ... you drop the frame or slow down the slide show? I am not familiar with a plugin that implements this strategy, but it will be interesting to implement.
source share