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