Progressbar Widgetversion added: 1.6
Description: Display status of a determinate or indeterminate process.
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 for overrides or as keys for the classes
option:
-
ui-progressbar
: The outer container of the progressbar. This element will additionally have a class ofui-progressbar-indeterminate
for indeterminate progressbars. For determinate progressbars, theui-progressbar-complete
class is added once the maximum value is reached.-
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
Additional Notes:
- 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.
Options
classes
|
Specify additional classes to add to the widget's elements. Any of classes specified in the Theming section can be used as keys to override their value. To learn more about this option, check out the learn article about the classes
option.
Initialize the progressbar with the classes
option specified, changing the theming for the ui-progressbar
class:
1
2
3
4
5
|
|
Get or set a property of the classes
option, after initialization, here reading and changing the theming for the ui-progressbar
class:
1
2
3
4
5
|
|
disabled
false
true
.Initialize the progressbar with the disabled
option specified:
1
2
3
|
|
Get or set the disabled
option, after initialization:
1
2
3
4
5
|
|
max
100
Initialize the progressbar with the max
option specified:
1
2
3
|
|
Get or set the max
option, after initialization:
1
2
3
4
5
|
|
value
0
-
Number:
A value between
0
and themax
. -
Boolean:
Value can be set to
false
to create an indeterminate progressbar.
Initialize the progressbar with the value
option specified:
1
2
3
|
|
Get or set the value
option, after initialization:
1
2
3
4
5
|
|
Methods
destroy()Returns: jQuery (plugin only)
- This method does not accept any arguments.
Invoke the destroy method:
1
|
|
disable()Returns: jQuery (plugin only)
- This method does not accept any arguments.
Invoke the disable method:
1
|
|
enable()Returns: jQuery (plugin only)
- This method does not accept any arguments.
Invoke the enable method:
1
|
|
instance()Returns: Object
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:
1
|
|
option( optionName )Returns: Object
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:
1
|
|
option()Returns: PlainObject
- This signature does not accept any arguments.
Invoke the method:
1
|
|
option( optionName, value )Returns: jQuery (plugin only)
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:
1
|
|
option( options )Returns: jQuery (plugin only)
-
optionsType: ObjectA map of option-value pairs to set.
Invoke the method:
1
|
|
value()Returns: Number or Boolean
- This signature does not accept any arguments.
Invoke the method:
1
|
|
value( value )Returns: jQuery (plugin only)
-
valueThe value to set. See the
value
option for details on valid values.
Invoke the method:
1
|
|
widget()Returns: jQuery
jQuery
object containing the progressbar.
- This method does not accept any arguments.
Invoke the widget method:
1
|
|
Events
change( event, ui )Type: progressbarchange
Note: The ui
object is empty but included for consistency with other events.
Initialize the progressbar with the change callback specified:
1
2
3
|
|
Bind an event listener to the progressbarchange event:
1
|
|
complete( event, ui )Type: progressbarcomplete
Note: The ui
object is empty but included for consistency with other events.
Initialize the progressbar with the complete callback specified:
1
2
3
|
|
Bind an event listener to the progressbarcomplete event:
1
|
|
create( event, ui )Type: progressbarcreate
Note: The ui
object is empty but included for consistency with other events.
Initialize the progressbar with the create callback specified:
1
2
3
|
|
Bind an event listener to the progressbarcreate event:
1
|
|
Examples:
A simple jQuery UI Progressbar
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
|
Demo:
A simple jQuery UI Indeterminate Progressbar
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
|