The progress bar is designed to display the current percent complete for a process. The bar is coded to be flexibly sized through CSS and will scale to fit inside its parent container by default.
A determinate progress bar should only be used in situations where the system can accurately update the current status. A determinate progress bar should never fill from left to right, then loop back to empty for a single process รข if the actual status cannot be calculated, an indeterminate progress bar should be used to provide user feedback.
Theming
The progressbar widget uses the jQuery UI CSS framework to style its look and feel. If progressbar specific styling is needed, the following CSS class names can be used:
-
ui-progressbar
: The outer container of the progressbar. This element will additionally have a class ofui-progressbar-indeterminate
for indeterminate progressbars.-
ui-progressbar-value
: The element that represents the filled portion of the progressbar.-
ui-progressbar-overlay
: Overlay used to display an animation for indeterminate progressbars.
-
-
Dependencies
- UI Core
- Widget Factory
- This widget requires some functional CSS, otherwise it won't work. If you build a custom theme, use the widget's specific CSS file as a starting point.
false
true
.Code examples:
Initialize the progressbar with the disabled
option specified:
$( ".selector" ).progressbar({ disabled: true });
Get or set the disabled
option, after initialization:
// Getter var disabled = $( ".selector" ).progressbar( "option", "disabled" ); // Setter $( ".selector" ).progressbar( "option", "disabled", true );
100
Code examples:
Initialize the progressbar with the max
option specified:
$( ".selector" ).progressbar({ max: 1024 });
Get or set the max
option, after initialization:
// Getter var max = $( ".selector" ).progressbar( "option", "max" ); // Setter $( ".selector" ).progressbar( "option", "max", 1024 );
0
Multiple types supported:
- Number: A value between
0
and themax
. - Boolean: Value can be set to
false
to create an indeterminate progressbar.
Code examples:
Initialize the progressbar with the value
option specified:
$( ".selector" ).progressbar({ value: 25 });
Get or set the value
option, after initialization:
// Getter var value = $( ".selector" ).progressbar( "option", "value" ); // Setter $( ".selector" ).progressbar( "option", "value", 25 );
- This method does not accept any arguments.
Invoke the destroy method:
$( ".selector" ).progressbar( "destroy" );
- This method does not accept any arguments.
Invoke the disable method:
$( ".selector" ).progressbar( "disable" );
- This method does not accept any arguments.
Invoke the enable method:
$( ".selector" ).progressbar( "enable" );
Retrieves the progressbar's instance object. If the element does not have an associated instance, undefined
is returned.
Unlike other widget methods, instance()
is safe to call on any element after the progressbar plugin has loaded.
- This method does not accept any arguments.
Invoke the instance method:
$( ".selector" ).progressbar( "instance" );
Gets the value currently associated with the specified optionName
.
Note: For options that have objects as their value, you can get the value of a specific key by using dot notation. For example, "foo.bar"
would get the value of the bar
property on the foo
option.
- optionNameType: StringThe name of the option to get.
Invoke the method:
var isDisabled = $( ".selector" ).progressbar( "option", "disabled" );
- This signature does not accept any arguments.
Invoke the method:
var options = $( ".selector" ).progressbar( "option" );
Sets the value of the progressbar option associated with the specified optionName
.
Note: For options that have objects as their value, you can set the value of just one property by using dot notation for optionName
. For example, "foo.bar"
would update only the bar
property of the foo
option.
- optionNameType: StringThe name of the option to set.
- valueType: ObjectA value to set for the option.
Invoke the method:
$( ".selector" ).progressbar( "option", "disabled", true );
- optionsType: ObjectA map of option-value pairs to set.
Invoke the method:
$( ".selector" ).progressbar( "option", { disabled: true } );
- This signature does not accept any arguments.
Invoke the method:
var progressSoFar = $( ".selector" ).progressbar( "value" );
- valueThe value to set. See the
value
option for details on valid values.
Invoke the method:
$( ".selector" ).progressbar( "value", 50 );
jQuery
object containing the progressbar. - This method does not accept any arguments.
Invoke the widget method:
var widget = $( ".selector" ).progressbar( "widget" );
progressbarchange
Note: The ui
object is empty but included for consistency with other events.
Initialize the progressbar with the change callback specified:
$( ".selector" ).progressbar({ change: function( event, ui ) {} });
Bind an event listener to the progressbarchange event:
$( ".selector" ).on( "progressbarchange", function( event, ui ) {} );
progressbarcomplete
Note: The ui
object is empty but included for consistency with other events.
Initialize the progressbar with the complete callback specified:
$( ".selector" ).progressbar({ complete: function( event, ui ) {} });
Bind an event listener to the progressbarcomplete event:
$( ".selector" ).on( "progressbarcomplete", function( event, ui ) {} );
progressbarcreate
Note: The ui
object is empty but included for consistency with other events.
Initialize the progressbar with the create callback specified:
$( ".selector" ).progressbar({ create: function( event, ui ) {} });
Bind an event listener to the progressbarcreate event:
$( ".selector" ).on( "progressbarcreate", function( event, ui ) {} );
A simple jQuery UI Progressbar
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>progressbar demo</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> </head> <body> <div id="progressbar"></div> <script> $( "#progressbar" ).progressbar({ value: 37 }); </script> </body> </html>
A simple jQuery UI Indeterminate Progressbar
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>progressbar demo</title> <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script> </head> <body> <div id="progressbar"></div> <script> $( "#progressbar" ).progressbar({ value: false }); </script> </body> </html>
Please login to continue.