jquery-ui/demos/progressbar/label.html

62 lines
1.3 KiB
HTML
Raw Normal View History

2012-11-30 04:12:30 +00:00
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
2012-12-04 03:25:55 +00:00
<title>jQuery UI Progressbar - Custom Label</title>
<link rel="stylesheet" href="../../themes/base/all.css">
<script src="../../external/jquery/jquery.js"></script>
<script src="../../ui/core.js"></script>
<script src="../../ui/widget.js"></script>
<script src="../../ui/progressbar.js"></script>
2012-11-30 04:12:30 +00:00
<link rel="stylesheet" href="../demos.css">
<style>
.ui-progressbar {
position: relative;
}
2012-12-04 03:25:55 +00:00
.progress-label {
position: absolute;
left: 50%;
top: 4px;
2012-12-04 03:25:55 +00:00
font-weight: bold;
text-shadow: 1px 1px 0 #fff;
}
2012-11-30 04:12:30 +00:00
</style>
<script>
$(function() {
2012-12-04 03:25:55 +00:00
var progressbar = $( "#progressbar" ),
progressLabel = $( ".progress-label" );
progressbar.progressbar({
2012-11-30 04:12:30 +00:00
value: false,
2012-12-04 03:25:55 +00:00
change: function() {
progressLabel.text( progressbar.progressbar( "value" ) + "%" );
},
complete: function() {
progressLabel.text( "Complete!" );
2012-11-30 04:12:30 +00:00
}
});
function progress() {
2012-12-04 03:25:55 +00:00
var val = progressbar.progressbar( "value" ) || 0;
2012-11-30 04:12:30 +00:00
progressbar.progressbar( "value", val + 2 );
2012-12-04 03:25:55 +00:00
if ( val < 99 ) {
setTimeout( progress, 80 );
2012-11-30 04:12:30 +00:00
}
}
setTimeout( progress, 2000 );
2012-11-30 04:12:30 +00:00
});
</script>
</head>
<body>
<div id="progressbar"><div class="progress-label">Loading...</div></div>
<div class="demo-description">
<p>Custom updated label demo.</p>
</div>
</body>
</html>