forked from rrx/jquery.showLoading
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjquery.showLoading.example.html
More file actions
178 lines (143 loc) · 3.81 KB
/
jquery.showLoading.example.html
File metadata and controls
178 lines (143 loc) · 3.81 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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>jQuery showLoading example</title>
<link href="css/showLoading.css" rel="stylesheet" media="screen" />
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/jquery.showLoading.js"></script>
<style type="text/css">
a {
color: blue;
cursor:pointer;
text-decoration: underline;
}
div.instructions_container {
float: left;
width: 350px;
margin-right: 50px;
}
div#activity_pane {
float:left;
width: 350px;
height: 200px;
border: 1px solid #CCCCCC;
background-color: #EEEEEE;
padding-top: 200px;
text-align: center;
}
div.example_links
.link_category {
margin-bottom: 15px;
}
.loading-indicator-bars {
background-image: url('images/loading-bars.gif');
width: 150px;
}
</style>
<script type="text/javascript">
jQuery(document).ready(
function() {
//
// When a user clicks the 'loading-default' link,
// call showLoading on the activity pane
// with default options
//
jQuery('a.loading-default').click(
function() {
jQuery('#activity_pane').showLoading();
}
);
//
// When a user clicks the 'loading-ajax' link,
// call showLoading, sleep, then call hide loading
// with default options
//
jQuery('a.loading-ajax').click(
function() {
jQuery('#activity_pane').showLoading(
{
'afterShow':
function() {
setTimeout( "jQuery('#activity_pane').hideLoading()", 1000 );
}
}
);
}
);
//
// When a user clicks the 'loading-bars' link,
// call showLoading with addClass specified
//
jQuery('a.loading-bars').click(
function() {
jQuery('#activity_pane').showLoading(
{
'addClass': 'loading-indicator-bars'
}
);
}
);
//
// When a user clicks the 'loading-hide' link,
// call hideLoading on the activity pane
//
jQuery('a.loading-hide').click(
function() {
jQuery('#activity_pane').hideLoading();
}
);
}
);
</script>
</head>
<body>
<div class="instructions_container">
<div class="example_links">
<div class="link_category">
<div class="link">
<a class="loading-default">Show default loading indicator</a>
</div>
<div class="link">
<a class="loading-hide">Hide default loading indicator</a>
</div>
</div>
<div class="link_category">
<div class="link">
<a class="loading-ajax">simulate 1-second Ajax load</a>
</div>
</div>
<div class="link_category">
<div class="link">
<a class="loading-bars">show 'bars'-style loading indicator</a>
</div>
<div class="link">
<a class="loading-hide">Hide 'bars'-style indicator</a>
</div>
</div>
</div>
<div class="usage">
Usage with jQuery load method:
<pre>
jQuery('#activity_pane').showLoading();
jQuery('#activity_pane').load(
'/path/to/my/url',
{},
function() {
//
//this is the ajax callback
//
jQuery('#activity_pane').hideLoading();
}
);
</pre>
</div>
</div>
<div id="activity_pane">
Here is where we will load something via ajax.
<br />
This container <b>must</b> have an id attribute
</div>
<div style="clear:both;"></div>
</body>
</html>