Animated Skeleton Loader In Pure JavaScript

Category: Loading | July 13, 2021
Author:amsrafid
Views Total:1,503 views
Official Page:Go to website
Last Update:July 13, 2021
License:MIT

Preview:

Animated Skeleton Loader In Pure JavaScript

Description:

A JavaScript library that helps you create a responsive, animated, customizable skeleton loader (also known as a content placeholder) for any content that is loading.

How to use it:

1. Insert the index.js into the HTML page.

<script src="index.js"></script>

2. Create an empty container to place the skeleton loader.

<div id="loader"></div>

3. Create skeleton loaders as follows:

new Loader('loader').render([
    // avatar shape: round, line, drawline
    ['round'], 
    // number of text lines
    ['line*3', 
    {
      // styles
      style: [{
        borderRadius: "5px"
      }, {
        borderRadius: "5px",
        width: '60%'
      }]
    }]
    ], {
      // number of loaders
      numbers: 2,
      // global styles
      parentStyle: {
          height: "50px",
          width: "80%"
      },
      style: {
          width: "100%"
      }
    }
);

You Might Be Interested In:


Leave a Reply