Skip to content

Commit

Permalink
do not activate viewporter in the case of iPad
Browse files Browse the repository at this point in the history
  • Loading branch information
pbakaus committed Aug 22, 2012
1 parent 00c56d6 commit 564e300
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions src/viewporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,31 @@ var viewporter;
// options
forceDetection: false,

// set to true to prevent page scroll.
// set to true to prevent page scroll.
preventPageScroll: false,

// constants
ACTIVE: (('ontouchstart' in window) || (/webos/i).test(navigator.userAgent)),
ACTIVE: (function() {

// iPad's don't allow you to scroll away the UI of the browser
if((/ipad/i).test(navigator.userAgent)) {
return false;
}

// WebOS has no touch events, but definitely the need for viewport normalization
if((/webos/i).test(navigator.userAgent)) {
return true;
}

// touch enabled devices
if('ontouchstart' in window) {
return true;
}

return false;

})(),

READY: false,

// methods
Expand Down Expand Up @@ -65,7 +85,7 @@ var viewporter;
// listen for orientation change
var cachedOrientation = window.orientation;
window.addEventListener('orientationchange', function() {
if(window.orientation != cachedOrientation) {
if(window.orientation !== cachedOrientation) {
that.prepareVisualViewport();
cachedOrientation = window.orientation;
}
Expand Down Expand Up @@ -224,4 +244,4 @@ viewporter.profiles = {
landscape: 320
}

}
};

0 comments on commit 564e300

Please sign in to comment.