-4

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..

2 Answers2

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
-1
  $(document).ready(function() {
 //load rest of images here code
    });   
EJ207
  • 49
  • 1
  • 3