aboutsummaryrefslogtreecommitdiffstats
path: root/ui/jquery.ui.slider.js
diff options
context:
space:
mode:
authorRichard D. Worth <rdworth@gmail.com>2010-05-11 08:17:18 -0400
committerRichard D. Worth <rdworth@gmail.com>2010-05-11 08:17:18 -0400
commit34912bc933d2787b0e3143b4dbd84e70bcc67928 (patch)
tree40182d7cf5e36fcec2a359558817edf35ee468de /ui/jquery.ui.slider.js
parentb7c0823da65254f420e4f8affefb4632ecad8f91 (diff)
downloadjquery-ui-34912bc933d2787b0e3143b4dbd84e70bcc67928.tar.gz
jquery-ui-34912bc933d2787b0e3143b4dbd84e70bcc67928.zip
Slider: fixed step alignment to handle negative fractional values. Fixed #5583 - Slider displays negative fractional values incorrectly. Thanks for the patch watanabe.
Diffstat (limited to 'ui/jquery.ui.slider.js')
-rw-r--r--ui/jquery.ui.slider.js6
1 files changed, 3 insertions, 3 deletions
diff --git a/ui/jquery.ui.slider.js b/ui/jquery.ui.slider.js
index 895b536c2..210ca769a 100644
--- a/ui/jquery.ui.slider.js
+++ b/ui/jquery.ui.slider.js
@@ -591,12 +591,12 @@ $.widget( "ui.slider", $.ui.mouse, {
if ( val > this._valueMax() ) {
return this._valueMax();
}
- var step = this.options.step,
+ var step = ( this.options.step > 0 ) ? this.options.step : 1,
valModStep = val % step,
alignValue = val - valModStep;
- if ( valModStep >= ( step / 2 ) ) {
- alignValue += step;
+ if ( Math.abs(valModStep) * 2 >= step ) {
+ alignValue += ( valModStep > 0 ) ? step : ( -step );
}
// Since JavaScript has problems with large floats, round