Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

do not activate viewporter in the case of iPad

  • Loading branch information...
commit 564e30085715eed824845a973169a0e09ec1c5f8 1 parent 00c56d6
Paul Bakaus pbakaus authored

Showing 1 changed file with 24 additions and 4 deletions. Show diff stats Hide diff stats

  1. +24 4 src/viewporter.js
28 src/viewporter.js
@@ -17,11 +17,31 @@ var viewporter;
17 17 // options
18 18 forceDetection: false,
19 19
20   - // set to true to prevent page scroll.
  20 + // set to true to prevent page scroll.
21 21 preventPageScroll: false,
22 22
23 23 // constants
24   - ACTIVE: (('ontouchstart' in window) || (/webos/i).test(navigator.userAgent)),
  24 + ACTIVE: (function() {
  25 +
  26 + // iPad's don't allow you to scroll away the UI of the browser
  27 + if((/ipad/i).test(navigator.userAgent)) {
  28 + return false;
  29 + }
  30 +
  31 + // WebOS has no touch events, but definitely the need for viewport normalization
  32 + if((/webos/i).test(navigator.userAgent)) {
  33 + return true;
  34 + }
  35 +
  36 + // touch enabled devices
  37 + if('ontouchstart' in window) {
  38 + return true;
  39 + }
  40 +
  41 + return false;
  42 +
  43 + })(),
  44 +
25 45 READY: false,
26 46
27 47 // methods
@@ -65,7 +85,7 @@ var viewporter;
65 85 // listen for orientation change
66 86 var cachedOrientation = window.orientation;
67 87 window.addEventListener('orientationchange', function() {
68   - if(window.orientation != cachedOrientation) {
  88 + if(window.orientation !== cachedOrientation) {
69 89 that.prepareVisualViewport();
70 90 cachedOrientation = window.orientation;
71 91 }
@@ -224,4 +244,4 @@ viewporter.profiles = {
224 244 landscape: 320
225 245 }
226 246
227   -}
  247 +};

0 comments on commit 564e300

Please sign in to comment.
Something went wrong with that request. Please try again.