Skip to content

Commit 1373f30

Browse files
committed
mobile grid
1 parent 9a8ac51 commit 1373f30

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

js/grid.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,13 @@
22
const gridCanvasEl = document.getElementById('gridCanvas');
33
const gridCtx = gridCanvasEl.getContext('2d');
44

5+
// Detect mobile device
6+
const isMobile = window.matchMedia("only screen and (max-width: 850px)").matches ||
7+
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
8+
59
const CONFIG = {
6-
squareSize: 55,
7-
borderWidth: 12,
10+
squareSize: isMobile ? 35 : 55, // Smaller for mobile, your value for desktop
11+
borderWidth: isMobile ? 6 : 12, // Smaller for mobile, your value for desktop
812
borderColor: '#f5e6d3',
913
navy: ['#0f1f2f', '#1a2838', '#142430', '#1f3040'],
1014
green: ['#2d5540', '#3d6a55', '#4a7a65', '#5a8575', '#6a9a8a', '#7aaa9a', '#3a5f4a', '#557f6a'],

0 commit comments

Comments
 (0)