Prelodr
A simple Material preloader inspired by Google Inbox.
🎉 View demo on Codepen
For React style check out react-prelodr.
Install
yarn add prelodr --dev
npm install prelodr --save-dev
CDN
The UMD and style files are also available on unpkg:
Available on JSDelivr
Available on cdnjs
You can use the library via window.prelodr
.
Usage
const pre = // a) Show prelodrpre // b) Hide prelodrpre
Async and chaining support
show(fn)
method supports an optional (fn) callback function.
const pre = // Step 1pre // Step 2pre // Step 3pre
Options
container
: Container element to append the preloader.zIndex
:zindex
style value.auto
: If it'strue
preloader shows automaticatly. Defaultfalse
duration
: Timing for show and hide transition.text
: Default showing text.prefixClass
: Prefix class for prelodr. Default isprelodr
class.
Methods
Prelodr.show(text)
Show the prelodr.
text
{String} : Text for prelodr.
Prelodr.hide(fn)
Hide the prelodr.
fn
{Function} : (Optional) Callback function
Prelodr.setPrefixClass(prefix)
options
{String} : Set the prefix class.
Prelodr.setDuration(miliseconds)
miliseconds
{Number} : Set the transition timing
Prelodr.setZIndex(zindex)
zindex
{Number} : Set thezindex
style value.
Prelodr.getElement()
Return the {HTMLElement} object.
Events
Prelodr.on('shown', fn)
Event when prelodr is shown.
Prelodr.on('hidden', fn)
Event when prelodr is hidden.
Changelog
Check out the changelog
Contributions
If you would like to contribute pull requests and issues will be welcome! Feature requests are welcome too. Please before sending some feature requests make sure provide as much detail and context as possible.
License
MIT license
© 2017 José Luis Quintana