Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 2b355ff

Browse files
committed
Merge pull request #173 from andreruffert/release/v2.0.2
Release: v2.0.2
2 parents 64b8744 + 79e0727 commit 2b355ff

File tree

5 files changed

+12
-44
lines changed

5 files changed

+12
-44
lines changed

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rangeslider.js",
3-
"version": "2.0.1",
3+
"version": "2.0.2",
44
"homepage": "https://github.com/andreruffert/rangeslider.js",
55
"authors": [
66
"André Ruffert <[email protected]>"

dist/rangeslider.js

+4-20
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*! rangeslider.js - v2.0.1 | (c) 2015 @andreruffert | MIT license | https://github.com/andreruffert/rangeslider.js */
1+
/*! rangeslider.js - v2.0.2 | (c) 2015 @andreruffert | MIT license | https://github.com/andreruffert/rangeslider.js */
22
(function(factory) {
33
'use strict';
44

@@ -205,22 +205,6 @@
205205
return str.charAt(0).toUpperCase() + str.substr(1);
206206
}
207207

208-
/**
209-
* Get cross-browser scroll position.
210-
* https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollX
211-
*
212-
* @param {String} coordinate x|y
213-
* @param {String} direction top|left
214-
* @return {Number}
215-
*/
216-
function getScrollOffset(coordinate, direction) {
217-
coordinate = ucfirst(coordinate);
218-
if (window['page' + coordinate + 'Offset'] !== undefined) {
219-
return window['page' + coordinate + 'Offset'];
220-
}
221-
return (document.documentElement || document.body.parentNode || document.body)['scroll' + ucfirst(direction)];
222-
}
223-
224208
/**
225209
* Plugin
226210
* @param {String} element
@@ -415,13 +399,13 @@
415399
};
416400

417401
Plugin.prototype.getRelativePosition = function(e) {
418-
// Get the offset DIRECTION relative to the viewport and scroll position
402+
// Get the offset DIRECTION relative to the viewport
419403
var ucCoordinate = ucfirst(this.COORDINATE),
420-
rangePos = this.$range[0].getBoundingClientRect()[this.DIRECTION] + getScrollOffset(this.COORDINATE, this.DIRECTION),
404+
rangePos = this.$range[0].getBoundingClientRect()[this.DIRECTION],
421405
pageCoordinate = 0;
422406

423407
if (typeof e['page' + ucCoordinate] !== 'undefined') {
424-
pageCoordinate = e['page' + ucCoordinate];
408+
pageCoordinate = e['client' + ucCoordinate];
425409
}
426410
else if (typeof e.originalEvent['client' + ucCoordinate] !== 'undefined') {
427411
pageCoordinate = e.originalEvent['client' + ucCoordinate];

dist/rangeslider.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
"name": "rangeslider.js",
33
"title": "rangeslider.js",
44
"description": "Simple, small and fast JavaScript/jQuery polyfill for the HTML5 <input type=\"range\"> slider element",
5-
"version": "2.0.1",
6-
"codename": "Lemon Yellow",
5+
"version": "2.0.2",
6+
"codename": "Jungle Green",
77
"main": "dist/rangeslider.js",
88
"homepage": "https://github.com/andreruffert/rangeslider.js",
99
"author": {

src/rangeslider.js

+3-19
Original file line numberDiff line numberDiff line change
@@ -204,22 +204,6 @@
204204
return str.charAt(0).toUpperCase() + str.substr(1);
205205
}
206206

207-
/**
208-
* Get cross-browser scroll position.
209-
* https://developer.mozilla.org/en-US/docs/Web/API/Window/scrollX
210-
*
211-
* @param {String} coordinate x|y
212-
* @param {String} direction top|left
213-
* @return {Number}
214-
*/
215-
function getScrollOffset(coordinate, direction) {
216-
coordinate = ucfirst(coordinate);
217-
if (window['page' + coordinate + 'Offset'] !== undefined) {
218-
return window['page' + coordinate + 'Offset'];
219-
}
220-
return (document.documentElement || document.body.parentNode || document.body)['scroll' + ucfirst(direction)];
221-
}
222-
223207
/**
224208
* Plugin
225209
* @param {String} element
@@ -414,13 +398,13 @@
414398
};
415399

416400
Plugin.prototype.getRelativePosition = function(e) {
417-
// Get the offset DIRECTION relative to the viewport and scroll position
401+
// Get the offset DIRECTION relative to the viewport
418402
var ucCoordinate = ucfirst(this.COORDINATE),
419-
rangePos = this.$range[0].getBoundingClientRect()[this.DIRECTION] + getScrollOffset(this.COORDINATE, this.DIRECTION),
403+
rangePos = this.$range[0].getBoundingClientRect()[this.DIRECTION],
420404
pageCoordinate = 0;
421405

422406
if (typeof e['page' + ucCoordinate] !== 'undefined') {
423-
pageCoordinate = e['page' + ucCoordinate];
407+
pageCoordinate = e['client' + ucCoordinate];
424408
}
425409
else if (typeof e.originalEvent['client' + ucCoordinate] !== 'undefined') {
426410
pageCoordinate = e.originalEvent['client' + ucCoordinate];

0 commit comments

Comments
 (0)