I've searched but haven't been able to find out a way to preload images using Bootstrap Carousel. I am building up a portfolio site with a lot of images and right now Bootstrap carousel works properly after all the images are loaded.

Any ideas?

有帮助吗?

解决方案

I'm pretty sure that the images in the Bootstrap carousel aren't loaded dynamically, but loaded with the page. Therefore there isn't any reason for you to preload.

Preloading is used when images are loaded onto the page dynamically. When this happens, the page has to load this image separate from the page, causing an undesirable lag between dynamic addition and image downloading/appearing.

Because bootstrap's carousel has it's images included in the HTML and simply hidden with javascript, the images are loaded with the page, resulting in whatever preloading would achieve for you.

tl;dr: You can't it's already done for you.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top