Thứ Sáu, 4 tháng 9, 2015

check loading


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
  1. $(function() {
  2. // Action on Click
  3. $( "#basic .btn" ).click(function() {
  4. $( this ).isLoading();
  5. // Load data or whatever
  6. $( "#basic .demo p" ).removeClass("alert-success");
  7. // Data Loaded, re-enable event
  8. setTimeout( function(){
  9. // Deactivate the loading plugin
  10. $( "#basic .btn" ).isLoading( "hide" );
  11. $( "#basic .demo p" ).html( "Content Loaded" )
  12. .addClass("alert-success");
  13. }, 1000 );
  14. });
  15. });

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
  1. $(function() {
  2. // Action on Click
  3. $( "#load-in-div .btn" ).click(function() {
  4. // Setup Loading plugin
  5. $( "#load-in-div .demo p" ).removeClass("alert-success").isLoading({
  6. text: "Loading",
  7. position: "inside",
  8. disableOthers: [
  9. $( "#load-in-div .btn" )
  10. ]
  11. });
  12. // Re-enabling event
  13. setTimeout( function(){
  14. $( "#load-in-div .demo p" ).isLoading( "hide" )
  15. .html( "Content Loaded" )
  16. .addClass("alert-success");
  17. }, 1000 );
  18. });
  19. });

Overlay

  1. $(function() {
  2. // Action on Click
  3. $( "#load-overlay .btn" ).click(function() {
  4. $.isLoading({ text: "Loading" });
  5. // Setup Loading plugin
  6. $( "#load-overlay .demo p" ).removeClass("alert-success");
  7. // Re-enabling event
  8. setTimeout( function(){
  9. $.isLoading( "hide" );
  10. $( "#load-overlay .demo p" ).html( "Content Loaded" )
  11. .addClass("alert-success");
  12. }, 2000 );
  13. });
  14. });

Overlay on Tag

  1. $(function() {
  2. // Action on Click
  3. $( "#load-overlay-elt .btn" ).click(function() {
  4. $( "#load-overlay-elt .demo" ).isLoading({
  5. text: "Loading",
  6. position: "overlay"
  7. });
  8. // Setup Loading plugin
  9. $( "#load-overlay-elt .demo p" ).removeClass("alert-success");
  10. // Re-enabling event
  11. setTimeout( function(){
  12. $( "#load-overlay-elt .demo" ).isLoading( "hide" );
  13. $( "#load-overlay-elt .demo p" ).html( "Content Loaded" )
  14. .addClass("alert-success");
  15. }, 2000 );
  16. });
  17. });

Download: tại đây

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

Đăng nhận xét