diff options
author | Mukul Hase <mukulhase@gmail.com> | 2016-02-12 00:59:54 +0530 |
---|---|---|
committer | Scott González <scott.gonzalez@gmail.com> | 2016-03-30 13:28:04 -0400 |
commit | a1905e2c5ed6e61e6a7206e005de9dda4f7135d0 (patch) | |
tree | 71d0cf18a05a9da9417a055d95df170d38b74980 /ui | |
parent | bff8277fbc885bf2dc0461ac706d2f2bb7035ad6 (diff) | |
download | jquery-ui-a1905e2c5ed6e61e6a7206e005de9dda4f7135d0.tar.gz jquery-ui-a1905e2c5ed6e61e6a7206e005de9dda4f7135d0.zip |
Slider: Fixed max value miscalculation
Fixes #12852
Closes gh-1664
Diffstat (limited to 'ui')
-rw-r--r-- | ui/widgets/slider.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ui/widgets/slider.js b/ui/widgets/slider.js index a2da892c4..8af032dcf 100644 --- a/ui/widgets/slider.js +++ b/ui/widgets/slider.js @@ -544,8 +544,13 @@ return $.widget( "ui.slider", $.ui.mouse, { var max = this.options.max, min = this._valueMin(), step = this.options.step, - aboveMin = Math.floor( ( +( max - min ).toFixed( this._precision() ) ) / step ) * step; + aboveMin = Math.round( ( max - min ) / step ) * step; max = aboveMin + min; + if ( max > this.options.max ) { + + //If max is not divisible by step, rounding off may increase its value + max -= step; + } this.max = parseFloat( max.toFixed( this._precision() ) ); }, |