]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
maybe solved the right handle overflow issue
authorChris Oyler <chris@zurb.com>
Tue, 5 Jan 2016 19:57:27 +0000 (11:57 -0800)
committerChris Oyler <chris@zurb.com>
Tue, 5 Jan 2016 19:57:27 +0000 (11:57 -0800)
js/foundation.slider.js

index 2a5bc536d1e175db61738092c5d5e30e309023c7..e79ed0e0adf0077f00b4b6ca0cbc7c73d5de0d16 100644 (file)
           //revised
           halfOfHandle =  ~~(percent(handleDim, elemDim) * 100),
           idx = this.handles.index($hndl);
-          // console.log(halfOfHandle);
+          console.log(halfOfHandle);
       if(isLeftHndl){
         var test = halfOfHandle * pctOfBar;
 
-        console.log(test, parseFloat(pctOfBar), percent(handleDim, elemDim));
+        // console.log(test, parseFloat(pctOfBar), percent(handleDim, elemDim));
         css[lOrT] = movement + '%';//
         //original
         // css[lOrT] = (pctOfBar > 0 ? (pctOfBar * 100) : 0) + '%';//
         dim = percent((this.$handle2.attr('aria-valuenow') - this.$handle.attr('aria-valuenow')), this.options.end) * 100;
+        var thing = parseFloat(this.$handle2[0].style[lOrT]) - movement + halfOfHandle;
+        // console.log(thing, movement);
         // dim = ((this.$handle2.attr('aria-valuenow') - this.$handle.attr('aria-valuenow')) / this.options.end) * 100;
-        css['min-' + hOrW] = dim + '%';
+        css['min-' + hOrW] = thing + '%';
+        // css['min-' + hOrW] = dim + '%';
         if(cb && typeof cb === 'function'){ cb(); }
       }else{
         var handleLeft = parseFloat(this.$handle[0].style.left);
         //further revised
-        console.log('loc before math',location);
+        var thing = movement - (parseFloat(this.$handle[0].style[lOrT]) || this.options.initialStart) + halfOfHandle;
         location = (location - ((!isNaN(handleLeft) ? handleLeft : this.options.end - location)));
-        movement += halfOfHandle;
+        console.log('test',movement, halfOfHandle, thing);
+        // movement += halfOfHandle;
         // revised edition
         // location = (location < this.options.end ? location : this.options.end) - ((!isNaN(handleLeft) ? handleLeft : this.options.end - location));
 
         // original
         // location = (location < 100 ? location : 100) - (!isNaN(handleLeft) ? handleLeft : this.options.end - location);
         // css['min-' + hOrW] = movement - parseFloat(this.$handle.attr('aria-valuenow')) + halfOfHandle /2 + '%';
-        css['min-' + hOrW] = location + '%';
+        css['min-' + hOrW] = thing + '%';
+        // css['min-' + hOrW] = location + '%';
         console.log('loc aftermath, lol',location);
       }
     }