Default options:
defaults = {
'position': "right", // right | inside | overlay
'text': "", // Text to display next to the loader
'class': "icon-refresh", // loader CSS class
'tpl': '<span class="isloading-wrapper %wrapper%">%text%<i class="%class% icon-spin"></i></span>',
'disableSource': true, // true | false
'disableOthers': []
};
Basic Loading
This is the most basic setup. Just use$( "selector" ).isLoading(); and you are done for the setup.
When your action (data loading, etc...) is done, just call
$( "selector" ).isLoading( "hide" ); and you are done.
Content Loaded
- $(function() {
- // Action on Click
- $( "#basic .btn" ).click(function() {
- $( this ).isLoading();
- // Load data or whatever
- $( "#basic .demo p" ).removeClass("alert-success");
- // Data Loaded, re-enable event
- setTimeout( function(){
- // Deactivate the loading plugin
- $( "#basic .btn" ).isLoading( "hide" );
- $( "#basic .demo p" ).html( "Content Loaded" )
- .addClass("alert-success");
- }, 1000 );
- });
- });
Load in Tag
This demo shows how to show the loading message inside the target.$( "selector" ).isLoading({ text: "Loading", position: "inside" });
If you want to disable some extra tags/input/etc... while the loading is active, you can use the
disableOthers[] option.
Content Loaded
- $(function() {
- // Action on Click
- $( "#load-in-div .btn" ).click(function() {
- // Setup Loading plugin
- $( "#load-in-div .demo p" ).removeClass("alert-success").isLoading({
- text: "Loading",
- position: "inside",
- disableOthers: [
- $( "#load-in-div .btn" )
- ]
- });
- // Re-enabling event
- setTimeout( function(){
- $( "#load-in-div .demo p" ).isLoading( "hide" )
- .html( "Content Loaded" )
- .addClass("alert-success");
- }, 1000 );
- });
- });
Overlay
- $(function() {
- // Action on Click
- $( "#load-overlay .btn" ).click(function() {
- $.isLoading({ text: "Loading" });
- // Setup Loading plugin
- $( "#load-overlay .demo p" ).removeClass("alert-success");
- // Re-enabling event
- setTimeout( function(){
- $.isLoading( "hide" );
- $( "#load-overlay .demo p" ).html( "Content Loaded" )
- .addClass("alert-success");
- }, 2000 );
- });
- });
Overlay on Tag
- $(function() {
- // Action on Click
- $( "#load-overlay-elt .btn" ).click(function() {
- $( "#load-overlay-elt .demo" ).isLoading({
- text: "Loading",
- position: "overlay"
- });
- // Setup Loading plugin
- $( "#load-overlay-elt .demo p" ).removeClass("alert-success");
- // Re-enabling event
- setTimeout( function(){
- $( "#load-overlay-elt .demo" ).isLoading( "hide" );
- $( "#load-overlay-elt .demo p" ).html( "Content Loaded" )
- .addClass("alert-success");
- }, 2000 );
- });
- });
Download: tại đây
link website: http://hekigan.github.io/is-loading/#overlay

Không có nhận xét nào:
Đăng nhận xét