A fork of jquery-loadmask which intends to modernise the look and feel of the original plugin by way of CSS updates and improved API usage.
The source code was exported to GitHub from Google Code
My additional functionality is noted in the original README document from the original repository along with some edits (shown below).
//cdn.calcroft.co/jquery.loadmask-plus.min.js
//cdn.calcroft.co/jquery.loadmask-plus.min.css
git clone https://github.com/robcalcroft/jquery-loadmask-plus.git
gem update --system && gem install compass
npm install gulp jshint -g && npm install
gulp
LoadMask jQuery plugin can mask DOM elements while their content is loading or changing to prevent user interactions and inform that some background task is still running. It is very light (~2Kb) and easy to use.
The behavior of this plugin is largely based on handy Element.mask() method from ExtJS Framework.
jQuery version required: > 1.2.3.
Please note that only elements that accept child nodes can be masked.
To start using the plugin you need to include jquery.loadmask.css and jquery.loadmask.js (or its minified version jquery.loadmask.min.js) to your html page:
<link rel="stylesheet" type="text/css" href="https://github.com/robcalcroft/jquery-loadmask-plus/blob/develop//cdn.calcroft.co/jquery.loadmask-plus.min.css" />
<script type="text/javascript" src="https://github.com/robcalcroft/jquery-loadmask-plus/raw/develop//cdn.calcroft.co/jquery.loadmask-plus.min.js"></script>
To put a mask over an element (or multiple elements) simply call mask(options)
method :
$("#myDiv").mask() // Will show the loading animation in white
$("#myDiv").mask({
iconColour: "red" // Updates the colour of the loading animation
});
// Alternatively, specify a label to be shown instead of the icon
$("#myDiv").mask({
label: "Loading",
delay: 500
});
iconColour
bgColour
delay
label
The delay
property sets a delay in milliseconds before element(s) is masked. If unmask()
is called before the delay times out, no mask is displayed. This can be used to prevent unnecessary mask display for quick processes.
Note that the if the label
property is set the icon will not be shown
To remove a previously displayed mask from an element (or multiple elements) call unmask()
without any parameters:
$("#mydiv").unmask();
Calling unmask()
on a delayed mask prevents it from showing up.
You can use isMasked()
method on a single element to check if it is currently masked. Please note that this method will return false
whilst mask is delayed.
if($("#mydiv").isMasked()) { ... }
Please take a look at this code.
Please take a look at this code.
Thank you!
Thanks to Sergiy for the creation of this plugin!