index.html
7.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
<!doctype html>
<html>
<head>
<title>isLoading jQuery plugin</title>
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.min.css" rel="stylesheet">
<link href="http://netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css" rel="stylesheet">
<link href="./style.css" rel="stylesheet">
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
</head>
<body>
<div class="header">
<div class="container wrapper">
<h1>isLoading | jQuery plugin</h1>
<h3>Project on Github: <a href="https://github.com/hekigan/is-loading">https://github.com/hekigan/is-loading</a></h3>
</div>
</div>
<div class="container wrapper" style="position: relative;">
<div class="top-menu">
<ul class="nav nav-list">
<li class="nav-header">Menu</li>
<li><a href="#">Top</a></li>
<li><a href="#basic">Basic</a></li>
<li><a href="#in-tag">In Tag</a></li>
<li><a href="#overlay">Overlay</a></li>
<li><a href="#overlay-tag">Overlay on Tag</a></li>
</ul>
</div>
<h3>Download links:</h3>
<ul>
<li>development version: <a href="../jquery.isloading.js">jquery.isloading.js</a></li>
<li>minified version: <a href="../jquery.isloading.min.js">jquery.isloading.min.js</a></li>
</ul>
<h3>Default options:</h3>
<pre>
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': []
};
</pre>
<!-- BASIC -->
<div id="basic">
<a name="basic"></a>
<h3>Basic Loading</h3>
<p>
This is the most basic setup.
Just use <code>$( "selector" ).isLoading();</code> and you are done for the setup.
</p>
<p>
When your action (data loading, etc...) is done, just call <code>$( "selector" ).isLoading( "hide" );</code> and you are done.
</p>
<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>
<p>
This demo shows how to show the loading message inside the target. <code>$( "selector" ).isLoading({ text: "Loading", position: "inside" });</code>
</p>
<p>
If you want to disable some extra tags/input/etc... while the loading is active, you can use the <code>disableOthers[]</code> option.
</p>
<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="http://www.codeotaku.com/_static/jquery-syntax/jquery.syntax.min.js" type="text/javascript"></script>
<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>
</body>
</html>