Skip to content

Commit

Permalink
Actually ensure changed event object exists. Fixes #25
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Azoff committed Sep 26, 2011
1 parent 7a97e2c commit 50ed528
Showing 1 changed file with 6 additions and 12 deletions.
18 changes: 6 additions & 12 deletions jquery.overscroll.js
@@ -1,5 +1,5 @@
/*
* Overscroll v1.4.7
* Overscroll v1.4.8
* A jQuery Plugin that emulates the iPhone scrolling experience in a browser.
* http://azoffdesign.com/overscroll
*
Expand Down Expand Up @@ -72,13 +72,6 @@
thumbOpacity: 0.7
},

checkIosDevice: function () {
if (o.isIOS === undefined) {
o.isIOS = /iP((hone)|(ad)|(od))/.test(navigator.platform);
}
return o.isIOS;
},

// main initialization function
init: function (target, options) {

Expand Down Expand Up @@ -304,10 +297,11 @@
},

normalizeEvent: function (event) {
if (o.checkIosDevice()) {
var iosEvent = event.originalEvent.changedTouches[0];
event.pageX = iosEvent.pageX;
event.pageY = iosEvent.pageY;
var ios, original = event.originalEvent;
if (original.changedTouches) {
ios = original.changedTouches;
event.pageX = ios.pageX;
event.pageY = ios.pageY;
}
},

Expand Down

0 comments on commit 50ed528

Please sign in to comment.