A flexible loader jQuery plugin.
- Enhancing the waiting of user with a flexible loader!
- Create a loader on multiple ajax calling to waiting the end of calls.
- Personalize your loader.
- Do anything after loading with the events.
An exemple of capability of this plugin:
// Call a first ajax
$.ajax({
url: "orders/listing.html",
beforeSend: function() {
$('body').yoload('show');
}
}).always(function() {
$('body').yoload('hide');
});
// Call a second ajax
$.ajax({
url: "orders/dashboard.html",
beforeSend: function() {
$('body').yoload('show');
}
}).always(function() {
$('body').yoload('hide');
});
// Do something at the end of ajax calls
$('body').on('yoload.hide', function(event) {
alert('Welcome in the new panel order');
});
Option | Type | Default | Description |
---|---|---|---|
fade | integer or string | 0 | Display the matched elements by fading them to opaque. Use 'slow', 'fast' or a number of milliseconds. |
template | string (html) | <span class="yoload"></span> |
Customize the HTML loader. |
You can use it like so:
$('body').yoload({
fade: 0,
template: '<span class="yoload"></span>'
});
Or like this for all calling:
$.fn.yoload.defaults.fade = 500;
Event | Params | Description |
---|---|---|
yoload.hide | event | After loader completely hiding |
yoload.counter | event, counter | When the counter is modify on "multiple" loader on element |
// On hiding loader
$('body').on('yoload.hide', function(event){
console.log('The loader is hiding');
});
// On counter change
$('body').on('yoload.counter', function(event, counter){
console.log('Counter: '+counter);
});
Method | Argument | Description |
---|---|---|
init |
options : object | Initializes yoload |
destroy |
Destroy yoload | |
show |
Show the loader | |
hide |
force : bool | Hide the loader. Possibility to force it with the parameter. |
Methods are called on yoLoad instances:
// Show the loader
$('body').yoload('show');
yoLoad works on IE9+ in addition to other modern browsers such as Chrome, Firefox, and Safari.
jQuery 1.8
Copyright (c) 2017-2018 Yohann Tilotti
Licensed under the MIT license.