From 7ff259dc187ff62fb8dbfc3356972269550550e0 Mon Sep 17 00:00:00 2001 From: Brian Tan Date: Sat, 12 Dec 2015 00:35:46 -0500 Subject: [PATCH] Update foundation.slider.js 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/foundation.slider.js b/js/foundation.slider.js index f198c3d3a..6d40e3ab9 100644 --- a/js/foundation.slider.js +++ b/js/foundation.slider.js @@ -164,7 +164,7 @@ 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); @@ -222,7 +222,7 @@ 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, -- 2.47.2