1 |
<!doctype html> |
2 |
<html lang="en"> |
3 |
<head> |
4 |
<meta charset="utf-8"> |
5 |
<title>jQuery UI Progressbar - Indeterminate Value</title> |
6 |
<link rel="stylesheet" href="../../themes/base/jquery.ui.all.css"> |
7 |
<script src="../../jquery-1.9.1.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 |
<script> |
13 |
$(function() { |
14 |
$( "#progressbar" ).progressbar({ |
15 |
value: false |
16 |
}); |
17 |
$( "button" ).on( "click", function( event ) { |
18 |
var target = $( event.target ), |
19 |
progressbar = $( "#progressbar" ), |
20 |
progressbarValue = progressbar.find( ".ui-progressbar-value" ); |
21 |
|
22 |
if ( target.is( "#numButton" ) ) { |
23 |
progressbar.progressbar( "option", { |
24 |
value: Math.floor( Math.random() * 100 ) |
25 |
}); |
26 |
} else if ( target.is( "#colorButton" ) ) { |
27 |
progressbarValue.css({ |
28 |
"background": '#' + Math.floor( Math.random() * 16777215 ).toString( 16 ) |
29 |
}); |
30 |
} else if ( target.is( "#falseButton" ) ) { |
31 |
progressbar.progressbar( "option", "value", false ); |
32 |
} |
33 |
}); |
34 |
}); |
35 |
</script> |
36 |
<style> |
37 |
#progressbar .ui-progressbar-value { |
38 |
background-color: #ccc; |
39 |
} |
40 |
</style> |
41 |
</head> |
42 |
<body> |
43 |
|
44 |
<div id="progressbar"></div> |
45 |
<button id="numButton">Random Value - Determinate</button> |
46 |
<button id="falseButton">Indeterminate</button> |
47 |
<button id="colorButton">Random Color</button> |
48 |
|
49 |
<div class="demo-description"> |
50 |
<p>Indeterminate progress bar and switching between determinate and indeterminate styles.</p> |
51 |
</div> |
52 |
</body> |
53 |
</html> |