Skip to content

Commit 548a6ce

Browse files
committed
Progressbar: Add custom label demo.
1 parent f2ee4c5 commit 548a6ce

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

demos/progressbar/label.html

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title>jQuery UI Progressbar - Default functionality</title>
6+
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
7+
<script src="../../jquery-1.8.3.js"></script>
8+
<script src="../../ui/jquery.ui.core.js"></script>
9+
<script src="../../ui/jquery.ui.widget.js"></script>
10+
<script src="../../ui/jquery.ui.progressbar.js"></script>
11+
<link rel="stylesheet" href="../demos.css">
12+
<style>
13+
.progress-label {
14+
float: left;
15+
margin-left: 50%;
16+
margin-top: 5px;
17+
font-weight: bold;
18+
}
19+
</style>
20+
<script>
21+
$(function() {
22+
$( "#progressbar" ).progressbar({
23+
value: false,
24+
change: function( event, ui ) {
25+
$( ".progress-label" ).text( $( "#progressbar" ).progressbar( "value" ) + "%" );
26+
}
27+
});
28+
29+
function progress() {
30+
var val = $( "#progressbar" ).progressbar( "value" );
31+
32+
if ( !val ) {
33+
val = 0;
34+
}
35+
if ( val < 100 ) {
36+
$( "#progressbar" ).progressbar( "value", val + 1 );
37+
setTimeout( function() {
38+
progress();
39+
}, 100);
40+
} else {
41+
$( ".progress-label" ).text( "Complete!" );
42+
}
43+
}
44+
45+
setTimeout( progress, 3000 );
46+
});
47+
</script>
48+
</head>
49+
<body>
50+
51+
<div id="progressbar"><div class="progress-label">Loading...</div></div>
52+
53+
<div class="demo-description">
54+
<p>Custom updated label demo.</p>
55+
</div>
56+
</body>
57+
</html>

0 commit comments

Comments
 (0)