Submit your widget

jQuery Loading Overlay

Created 5 years ago   Views 20041   downloads 4768    Author jgerigmeyer
jQuery Loading Overlay
View DemoDownload
81
Share |

Uses Javascript to add/remove a loading overlay to a target element. It can be called on any element that should receive the loading overlay, and accepts options for class selectors and loading overlay text. The overlay itself must be styled via CSS.

Getting Started

Download the production version or the development version.

In your web page:

<script src="jquery.js"></script>
<script src="dist/loading-overlay.min.js"></script>
<script>
jQuery(function($) {
    // Calling the plugin
    // (prepends a div.loading to the target element)
    $('#target').loadingOverlay();

    // Removing the loading overlay
    $('#target').loadingOverlay('remove');
});
</script>

Documentation

Available options, explictly set to their defaults:

$('#target').loadingOverlay({
    loadingClass: 'loading',            // Class added to `target` while loading
    overlayClass: 'loading-overlay',    // Class added to loading overlay (to be styled in CSS)
    spinnerClass: 'loading-spinner',    // Class added to loading overlay spinner
    iconClass: 'loading-icon',          // Class added to loading overlay spinner
    textClass: 'loading-text',          // Class added to loading overlay spinner
    loadingText: 'loading'              // Text within loading overlay
});

NOTE: If loadingClass or overlayClass options are passed when initializing the loading overlay, the same options must be passed when removing that overlay:

$('#target').loadingOverlay('remove', {
    loadingClass: 'loading',
    overlayClass: 'loading-overlay'
});