Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Commit

Permalink
fix: getRelativePosition use clientX/clientY instead of pageX/pageY
Browse files Browse the repository at this point in the history
close #236
close #238
close #239

Bug introduced in 53fa2d1
  • Loading branch information
andreruffert committed Nov 30, 2016
1 parent e56430a commit 5d295c5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
15 changes: 8 additions & 7 deletions dist/rangeslider.js
Original file line number Diff line number Diff line change
Expand Up @@ -402,15 +402,16 @@
rangePos = this.$range[0].getBoundingClientRect()[this.DIRECTION],
pageCoordinate = 0;

if (typeof e['page' + ucCoordinate] !== 'undefined') {
pageCoordinate = e['page' + ucCoordinate];
}
// IE8 support :)
else if (typeof e.originalEvent['client' + ucCoordinate] !== 'undefined') {
if (typeof e.originalEvent['client' + ucCoordinate] !== 'undefined') {
console.log('client' + ucCoordinate);
pageCoordinate = e.originalEvent['client' + ucCoordinate];
}
else if (e.originalEvent.touches && e.originalEvent.touches[0] && typeof e.originalEvent.touches[0]['page' + ucCoordinate] !== 'undefined') {
pageCoordinate = e.originalEvent.touches[0]['page' + ucCoordinate];
else if (
e.originalEvent.touches &&
e.originalEvent.touches[0] &&
typeof e.originalEvent.touches[0]['client' + ucCoordinate] !== 'undefined'
) {
pageCoordinate = e.originalEvent.touches[0]['client' + ucCoordinate];
}
else if(e.currentPoint && typeof e.currentPoint[this.COORDINATE] !== 'undefined') {
pageCoordinate = e.currentPoint[this.COORDINATE];
Expand Down
2 changes: 1 addition & 1 deletion dist/rangeslider.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions src/rangeslider.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,15 +401,16 @@
rangePos = this.$range[0].getBoundingClientRect()[this.DIRECTION],
pageCoordinate = 0;

if (typeof e['page' + ucCoordinate] !== 'undefined') {
pageCoordinate = e['page' + ucCoordinate];
}
// IE8 support :)
else if (typeof e.originalEvent['client' + ucCoordinate] !== 'undefined') {
if (typeof e.originalEvent['client' + ucCoordinate] !== 'undefined') {
console.log('client' + ucCoordinate);
pageCoordinate = e.originalEvent['client' + ucCoordinate];
}
else if (e.originalEvent.touches && e.originalEvent.touches[0] && typeof e.originalEvent.touches[0]['page' + ucCoordinate] !== 'undefined') {
pageCoordinate = e.originalEvent.touches[0]['page' + ucCoordinate];
else if (
e.originalEvent.touches &&
e.originalEvent.touches[0] &&
typeof e.originalEvent.touches[0]['client' + ucCoordinate] !== 'undefined'
) {
pageCoordinate = e.originalEvent.touches[0]['client' + ucCoordinate];
}
else if(e.currentPoint && typeof e.currentPoint[this.COORDINATE] !== 'undefined') {
pageCoordinate = e.currentPoint[this.COORDINATE];
Expand Down

0 comments on commit 5d295c5

Please sign in to comment.