mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Progressbar: Custom label demo cleanup
This commit is contained in:
parent
9bd44301d3
commit
da240d9da1
@ -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>
|
||||
@ -15,30 +15,31 @@
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user