loading效果 加载中效果
点击test可以查看效果
XML/HTML Code
- <div class="container wrapper" style="position: relative;">
- <h3>Default options:</h3>
- <!-- BASIC -->
- <div id="basic"> <a name="basic"></a>
- <div class="demo well">
- <p class="alert">container</p>
- <span class="btn">Test</span> </div>
- <pre class="example syntax javascript"></pre>
- <script>
- $(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 );
- });
- });
- </script>
- </div>
- <!--// BASIC -->
- <!-- LOAD IN DOM -->
- <div id="load-in-div"> <a name="in-tag"></a>
- <h3>Load in Tag</h3>
- <div id="load1" class="demo well">
- <p class="alert">container</p>
- <span class="btn">Test</span> </div>
- <pre class="example syntax javascript"></pre>
- <script>
- $(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 );
- });
- });
- </script>
- </div>
- <!--// LOAD IN DOM -->
- <!-- OVERLAY -->
- <div id="load-overlay"> <a name="overlay"></a>
- <h3>Overlay</h3>
- <div class="demo well">
- <p class="alert">container</p>
- <span class="btn">Test</span> </div>
- <pre class="example syntax javascript"></pre>
- <script>
- $(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 );
- });
- });
- </script>
- </div>
- <!--// OVERLAY -->
- <!-- OVERLAY AN ELEMENT -->
- <div id="load-overlay-elt"> <a name="overlay-tag"></a>
- <h3>Overlay on Tag</h3>
- <div class="demo well">
- <p class="alert">container</p>
- <span class="btn">Test</span> </div>
- <pre class="example syntax javascript"></pre>
- <script>
- $(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 );
- });
- });
- </script>
- </div>
- <!--// OVERLAY AN ELEMENT -->
- </div>
- <!-- syntax highlighter -->
- <script src="./jquery.isloading.js" type="text/javascript"></script>
- <script>
- $(function() {
- $( ".container script" ).each( function( i, e ) {;
- $( e ).siblings("pre.example").html( $( e ).html().trim() ).wrapInner( "<code />" );
- });
- $.syntax();
- });
- </script>
原文地址:http://www.freejs.net/article_jquerywenzi_239.html