aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKris Borchers <kris.borchers@gmail.com>2012-12-03 21:25:55 -0600
committerKris Borchers <kris.borchers@gmail.com>2012-12-03 21:26:13 -0600
commitda240d9da104921534a18a9dc62ff1c15f0ed650 (patch)
treed569cd579d0eba59b26456751c031a09cf91a4b7
parent9bd44301d36103a951cd9026682b93b7ff0bdd2f (diff)
downloadjquery-ui-da240d9da104921534a18a9dc62ff1c15f0ed650.tar.gz
jquery-ui-da240d9da104921534a18a9dc62ff1c15f0ed650.zip
Progressbar: Custom label demo cleanup
-rw-r--r--demos/progressbar/label.html43
1 files changed, 22 insertions, 21 deletions
diff --git a/demos/progressbar/label.html b/demos/progressbar/label.html
index c4334b65c..25394b205 100644
--- a/demos/progressbar/label.html
+++ b/demos/progressbar/label.html
@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="utf-8">
- <title>jQuery UI Progressbar - Default functionality</title>
+ <title>jQuery UI Progressbar - Custom Label</title>
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css">
<script src="../../jquery-1.8.3.js"></script>
<script src="../../ui/jquery.ui.core.js"></script>
@@ -10,35 +10,36 @@
<script src="../../ui/jquery.ui.progressbar.js"></script>
<link rel="stylesheet" href="../demos.css">
<style>
- .progress-label {
- float: left;
- margin-left: 50%;
- margin-top: 5px;
- font-weight: bold;
- }
+ .progress-label {
+ float: left;
+ margin-left: 50%;
+ margin-top: 5px;
+ font-weight: bold;
+ text-shadow: 1px 1px 0 #fff;
+ }
</style>
<script>
$(function() {
- $( "#progressbar" ).progressbar({
+ var progressbar = $( "#progressbar" ),
+ progressLabel = $( ".progress-label" );
+
+ progressbar.progressbar({
value: false,
- change: function( event, ui ) {
- $( ".progress-label" ).text( $( "#progressbar" ).progressbar( "value" ) + "%" );
+ change: function() {
+ progressLabel.text( progressbar.progressbar( "value" ) + "%" );
+ },
+ complete: function() {
+ progressLabel.text( "Complete!" );
}
});
function progress() {
- var val = $( "#progressbar" ).progressbar( "value" );
+ var val = progressbar.progressbar( "value" ) || 0;
- if ( !val ) {
- val = 0;
- }
- if ( val < 100 ) {
- $( "#progressbar" ).progressbar( "value", val + 1 );
- setTimeout( function() {
- progress();
- }, 100);
- } else {
- $( ".progress-label" ).text( "Complete!" );
+ progressbar.progressbar( "value", val + 1 );
+
+ if ( val < 99 ) {
+ setTimeout( progress, 100 );
}
}