Skip to content

Commit

Permalink
Stopped ProcessingJS running on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
harrymt committed Feb 10, 2016
1 parent 79ccead commit 0d28c29
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion development.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</head>
<body>

<canvas data-processing-sources="main.pde"></canvas>
<canvas id="processing-background" data-processing-sources="main.pde"></canvas>

<div class="cover-gradient"></div>

Expand Down
6 changes: 3 additions & 3 deletions index.html

Large diffs are not rendered by default.

18 changes: 17 additions & 1 deletion js/dev/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
//
// main.js
//
//

function IsMobile() {
return !!( navigator.userAgent.match(/Android/i) ||
navigator.userAgent.match(/webOS/i) ||
navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/iPod/i) ||
navigator.userAgent.match(/BlackBerry/i) ||
navigator.userAgent.match(/Windows Phone/i)
);
}

// Stop canvas from being drawn on mobiles
if(IsMobile() || $(window).width() < 500) {
$('#processing-background').css("display", "none");
}
6 changes: 3 additions & 3 deletions js/main.min.js

Large diffs are not rendered by default.

0 comments on commit 0d28c29

Please sign in to comment.