A very simple helper for building and applying Skeleton Screens over child elements of a node for ajax loading purposes.
You don't need anything. This thing is pure Javascript. I'll just warn that this should only be used in modern browsers.
bower install --save https://github.com/picklepilot/Skeletize.js.git
<link rel="stylesheet" href="skeletize.min.css">
<script src="skeletize.js"></script>
let skeletize = new Skeletize();
Note: Skeletize.js is more of a helper to call on elements on demand, therefor initialization is just to register the main caller.
skeletize.setTarget('.target-element').create();
This will create a skeleton screen over .target-element
. Make sure to give the target a position:relative
at least. Skeletize.js will automatically detect an element's width
, height
, offsets
and position the built skeleton screen over the target.
Via data-skeletize-text
<div class="target-element" data-skeletize-text="Loading new stuff..."></div>
This will automatically inject the text into the skeleton part.