]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Update foundation.slider.js 7512/head
authorBrian Tan <briantan888@users.noreply.github.com>
Sat, 12 Dec 2015 05:35:46 +0000 (00:35 -0500)
committerBrian Tan <briantan888@users.noreply.github.com>
Sat, 12 Dec 2015 05:35:46 +0000 (00:35 -0500)
1. Fix binding of 2nd input.

2. Fix data-decimal=0 slider freeze bug. toFixed pctOfBar to 2 decimal regardless of data-decimal.

js/foundation.slider.js

index f198c3d3a4afab347b23772dcea839f715e8fb4a..6d40e3ab9bd7b73c4878043d8e8427f8d625ba36 100644 (file)
     if(this.handles[1]){
       this.options.doubleSided = true;
       this.$handle2 = this.handles.eq(1);
-      this.$input2 = this.inputs.length ? this.inputs.eq(1) : $('#' + this.$handle2.attr('aria-controls'));
+      this.$input2 = this.inputs.length > 1 ? this.inputs.eq(1) : $('#' + this.$handle2.attr('aria-controls'));
 
       if(!this.inputs[1]){
         this.inputs = this.inputs.add(this.$input2);
         lOrT = vert ? 'top' : 'left',
         halfOfHandle = $hndl[0].getBoundingClientRect()[hOrW] / 2,
         elemDim = this.$element[0].getBoundingClientRect()[hOrW],
-        pctOfBar = percent(location, this.options.end).toFixed(this.options.decimal),
+        pctOfBar = percent(location, this.options.end).toFixed(2),
         pxToMove = (elemDim - halfOfHandle) * pctOfBar,
         movement = (percent(pxToMove, elemDim) * 100).toFixed(this.options.decimal),
         location = location > 0 ? parseFloat(location.toFixed(this.options.decimal)) : 0,