Vanilla JavaScript Library For Image Preloading – Vanilla Preloader

Category: Loading | July 20, 2016
Author: benjamincrozat
Views Total: 1,979
Official Page: Go to website
Last Update: July 20, 2016
License: MIT

Preview:

Vanilla JavaScript Library For Image Preloading – Vanilla Preloader

Description:

A simple vanilla JavaScript library used to preload an array of images which are needed later.

How to use it:

Import the Vanilla Preloader into your web project.

<script src="vanilla-preloader.min.js"></script>

Create a new VanillaPreloader and specify the images you want to preload.

new VanillaPreloader([
    '1.jpg',
    '2.jpg',
    '3.jpg'
]);

Execute a callback when all the images have been loaded.

new VanillaPreloader([
    '1.jpg',
    '2.jpg',
    '3.jpg'
], function (images) {
  console.log('Every image is now loaded!');
});

You Might Be Interested In:


Leave a Reply