I have a web page that displays 100 images in slider. I wish to display only 10 images when page load. After page load, the remaining 90 images should display..
Asked
Active
Viewed 126 times
-4
-
What slider you are using, refer to their documentation – Ima Nov 28 '16 at 09:49
-
you send only ten images from your php script, then in your js you run an ajax to load the rest – smarber Nov 28 '16 at 09:50
2 Answers
2
This would be called image pre loading and usually can be done in JavaScript or jQuery to load the images before hand so your images will load faster. Here is a how-to guide on pre loading images. JavaScript Preloading Images or checkout this guide which uses CSS and jQuery https://css-tricks.com/snippets/jquery/image-preloader/
Here is an example in jQuery. Enjoy!
$.preloadImages = function() {
for (var i = 0; i < arguments.length; i++) {
$("<img />").attr("src", arguments[i]);
}
}
$.preloadImages("hoverimage1.jpg","hoverimage2.jpg");
Basically it calls these images to be used before the page is loaded and that will load the images into the cache making it faster when being called later in the browser.

Community
- 1
- 1

Steven Hammons
- 118
- 14