2 * jQuery UI Progressbar 1.8.2
4 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
5 * Dual licensed under the MIT (MIT-LICENSE.txt)
6 * and GPL (GPL-LICENSE.txt) licenses.
8 * http://docs.jquery.com/UI/Progressbar
16 $.widget( "ui.progressbar", {
22 .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
25 "aria-valuemin": this._valueMin(),
26 "aria-valuemax": this._valueMax(),
27 "aria-valuenow": this._value()
30 this.valueDiv
= $( "<div class='ui-progressbar-value ui-widget-header ui-corner-left'></div>" )
31 .appendTo( this.element
);
38 .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" )
40 .removeAttr( "aria-valuemin" )
41 .removeAttr( "aria-valuemax" )
42 .removeAttr( "aria-valuenow" );
44 this.valueDiv
.remove();
46 $.Widget
.prototype.destroy
.apply( this, arguments
);
49 value: function( newValue
) {
50 if ( newValue
=== undefined ) {
54 this._setOption( "value", newValue
);
58 _setOption: function( key
, value
) {
61 this.options
.value
= value
;
63 this._trigger( "change" );
67 $.Widget
.prototype._setOption
.apply( this, arguments
);
71 var val
= this.options
.value
;
72 // normalize invalid value
73 if ( typeof val
!== "number" ) {
76 if ( val
< this._valueMin() ) {
77 val
= this._valueMin();
79 if ( val
> this._valueMax() ) {
80 val
= this._valueMax();
86 _valueMin: function() {
90 _valueMax: function() {
94 _refreshValue: function() {
95 var value
= this.value();
97 [ value
=== this._valueMax() ? "addClass" : "removeClass"]( "ui-corner-right" )
98 .width( value
+ "%" );
99 this.element
.attr( "aria-valuenow", value
);
103 $.extend( $.ui
.progressbar
, {