Skip to content

Instantly share code, notes, and snippets.

@ErikBernskiold
Created October 15, 2018 09:40
Show Gist options
  • Save ErikBernskiold/4482490c58918e8b7d51aef9e01cfa2a to your computer and use it in GitHub Desktop.
Save ErikBernskiold/4482490c58918e8b7d51aef9e01cfa2a to your computer and use it in GitHub Desktop.
LoadingOverlay Helper Module
"use strict";
/**
* Loading
*
* A loading indicator that can be activated for the entire
* website or on an element basis.
*
* Requires https://cdn.jsdelivr.net/npm/[email protected]/dist/loadingoverlay.min.js
*/
export function loading() {
const LOADING_OVERLAY_OPTIONS = {
background: 'rgba(197, 0, 114, 0.9)',
imageColor: '#ffffff'
};
return {
showForSite: function() {
jQuery.LoadingOverlay('show', LOADING_OVERLAY_OPTIONS);
},
hideForSite: function() {
jQuery.LoadingOverlay('hide');
},
showForElement: function(element) {
jQuery(element).LoadingOverlay('show', LOADING_OVERLAY_OPTIONS);
},
hideForElement: function(element) {
jQuery(element).LoadingOverlay('hide');
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment