Skip to content

Commit 0d28c29

Browse files
committed
Stopped ProcessingJS running on mobile
1 parent 79ccead commit 0d28c29

File tree

4 files changed

+24
-8
lines changed

4 files changed

+24
-8
lines changed

development.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
</head>
2626
<body>
2727

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

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

index.html

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

js/dev/main.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
11
//
22
// main.js
3-
//
3+
//
4+
5+
function IsMobile() {
6+
return !!( navigator.userAgent.match(/Android/i) ||
7+
navigator.userAgent.match(/webOS/i) ||
8+
navigator.userAgent.match(/iPhone/i) ||
9+
navigator.userAgent.match(/iPad/i) ||
10+
navigator.userAgent.match(/iPod/i) ||
11+
navigator.userAgent.match(/BlackBerry/i) ||
12+
navigator.userAgent.match(/Windows Phone/i)
13+
);
14+
}
15+
16+
// Stop canvas from being drawn on mobiles
17+
if(IsMobile() || $(window).width() < 500) {
18+
$('#processing-background').css("display", "none");
19+
}

js/main.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)