diff options
author | Scott González <scott.gonzalez@gmail.com> | 2012-03-14 13:42:48 -0400 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2012-03-14 13:42:48 -0400 |
commit | 682a321d1e4b80835a860f82fb686cff4943982b (patch) | |
tree | 6f49b28f40fb952977cdfbccb80dd553640dea4b /ui/jquery.ui.slider.js | |
parent | 94f85149db2a8b2540f9b204c14d57d8b087fbf6 (diff) | |
parent | ec062c1156d58726dc212e6e2191ee7196302c44 (diff) | |
download | jquery-ui-682a321d1e4b80835a860f82fb686cff4943982b.tar.gz jquery-ui-682a321d1e4b80835a860f82fb686cff4943982b.zip |
Merge branch 'master' into selectmenu
Diffstat (limited to 'ui/jquery.ui.slider.js')
-rw-r--r-- | ui/jquery.ui.slider.js | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/ui/jquery.ui.slider.js b/ui/jquery.ui.slider.js index aff9093ba..75c6631ca 100644 --- a/ui/jquery.ui.slider.js +++ b/ui/jquery.ui.slider.js @@ -1,7 +1,7 @@ /* * jQuery UI Slider @VERSION * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) + * Copyright 2012, AUTHORS.txt (http://jqueryui.com/about) * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * @@ -74,7 +74,7 @@ $.widget( "ui.slider", $.ui.mouse, { .addClass( "ui-slider-range" + // note: this isn't the most fittingly semantic framework class for this element, // but worked best visually with a variety of themes - " ui-widget-header" + + " ui-widget-header" + ( ( o.range === "min" || o.range === "max" ) ? " ui-slider-range-" + o.range : "" ) ); } @@ -110,21 +110,21 @@ $.widget( "ui.slider", $.ui.mouse, { }); this.handles.each(function( i ) { - $( this ).data( "index.ui-slider-handle", i ); + $( this ).data( "ui-slider-handle-index", i ); }); this.handles .keydown(function( event ) { - var index = $( this ).data( "index.ui-slider-handle" ), + var index = $( this ).data( "ui-slider-handle-index" ), allowed, curVal, newVal, step; - + if ( self.options.disabled ) { return; } - + switch ( event.keyCode ) { case $.ui.keyCode.HOME: case $.ui.keyCode.END: @@ -145,14 +145,14 @@ $.widget( "ui.slider", $.ui.mouse, { } break; } - + step = self.options.step; if ( self.options.values && self.options.values.length ) { curVal = newVal = self.values( index ); } else { curVal = newVal = self.value(); } - + switch ( event.keyCode ) { case $.ui.keyCode.HOME: newVal = self._valueMin(); @@ -181,19 +181,19 @@ $.widget( "ui.slider", $.ui.mouse, { newVal = self._trimAlignValue( curVal - step ); break; } - + self._slide( event, index, newVal ); }) .keyup(function( event ) { - var index = $( this ).data( "index.ui-slider-handle" ); - + var index = $( this ).data( "ui-slider-handle-index" ); + if ( self._keySliding ) { self._keySliding = false; self._stop( event, index ); self._change( event, index ); $( this ).removeClass( "ui-state-active" ); } - + }); this._refreshValue(); @@ -275,7 +275,7 @@ $.widget( "ui.slider", $.ui.mouse, { closestHandle .addClass( "ui-state-active" ) .focus(); - + offset = closestHandle.offset(); mouseOverHandle = !$( event.target ).parents().andSelf().is( ".ui-slider-handle" ); this._clickOffset = mouseOverHandle ? { left: 0, top: 0 } : { @@ -301,7 +301,7 @@ $.widget( "ui.slider", $.ui.mouse, { _mouseDrag: function( event ) { var position = { x: event.pageX, y: event.pageY }, normValue = this._normValueFromMouse( position ); - + this._slide( event, this._handleIndex, normValue ); return false; @@ -320,7 +320,7 @@ $.widget( "ui.slider", $.ui.mouse, { return false; }, - + _detectOrientation: function() { this.orientation = ( this.options.orientation === "vertical" ) ? "vertical" : "horizontal"; }, @@ -377,7 +377,7 @@ $.widget( "ui.slider", $.ui.mouse, { if ( this.options.values && this.options.values.length ) { otherVal = this.values( index ? 0 : 1 ); - if ( ( this.options.values.length === 2 && this.options.range === true ) && + if ( ( this.options.values.length === 2 && this.options.range === true ) && ( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) ) ) { newVal = otherVal; @@ -562,7 +562,7 @@ $.widget( "ui.slider", $.ui.mouse, { return vals; } }, - + // returns the step-aligned value that val is closest to, between (inclusive) min and max _trimAlignValue: function( val ) { if ( val <= this._valueMin() ) { @@ -591,7 +591,7 @@ $.widget( "ui.slider", $.ui.mouse, { _valueMax: function() { return this.options.max; }, - + _refreshValue: function() { var oRange = this.options.range, o = this.options, |