]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
seems to fix left handle causing overflow, working on right handle
authorChris Oyler <chris@zurb.com>
Tue, 5 Jan 2016 19:33:48 +0000 (11:33 -0800)
committerChris Oyler <chris@zurb.com>
Tue, 5 Jan 2016 19:33:48 +0000 (11:33 -0800)
js/foundation.slider.js

index ceb0ad21cc9a5e8fa5c8816ad3106d9d4fae3b62..2a5bc536d1e175db61738092c5d5e30e309023c7 100644 (file)
       var isLeftHndl = this.handles.index($hndl) === 0,
           dim,
           //revised
-          halfOfHandle =  ~~(percent(handleDim/2, elemDim) * 100),
+          halfOfHandle =  ~~(percent(handleDim, elemDim) * 100),
           idx = this.handles.index($hndl);
-          console.log(halfOfHandle);
+          // console.log(halfOfHandle);
       if(isLeftHndl){
-        css[lOrT] = (pctOfBar > 0 ? (pctOfBar * 100) : 0) + '%';//
-        dim = ((this.$handle2.attr('aria-valuenow') - this.$handle.attr('aria-valuenow')) / this.options.end) * 100;
+        var test = halfOfHandle * pctOfBar;
+
+        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;
+        // dim = ((this.$handle2.attr('aria-valuenow') - this.$handle.attr('aria-valuenow')) / this.options.end) * 100;
         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);
-        location = location - ((!isNaN(handleLeft) ? handleLeft : this.options.end - location));
-
+        location = (location - ((!isNaN(handleLeft) ? handleLeft : this.options.end - location)));
+        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 + '%';
         console.log('loc aftermath, lol',location);
       }