I have an element on a webpage with a background image applied to it. There are six different images and I show each of them one by one. Currently, the first image is shown for four seconds and then the next one is shown for four seconds and so on.
The problem I am facing is that I can't control the order in which the images are downloaded. While the browser is showing the first image, I want it to prioritize the downloading of second image in the slideshow. When the browser is showing second image, I want it to prioritize the downloading of third image. This way the users won't see a flash when the images change.
At present it seems like the browser is downloading images in random order. Here is my CSS:
@keyframes slideshow {
0% {
background: url('1.jpg');
}
4% {
background: url('1.jpg');
}
6% {
background: url('2.jpg');
}
14% {
background: url('2.jpg');
}
.... and so on.
}
Is there any way for me to force the browser to download image 2.jpg while I am showing 1.jpg in the background?
Thanks.