Skip to content

Commit b0fb34e

Browse files
committed
Enhance mobile responsiveness and layout in secrets.html and secrets.css
- Added viewport meta tag in secrets.html for better mobile scaling. - Updated CSS in secrets.css to improve touch interactions and prevent text selection on mobile devices. - Adjusted padding in secrets.js for better layout on smaller screens, optimizing the display of elements.
1 parent 1745692 commit b0fb34e

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

css/secrets.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ body {
33
position: relative;
44
background: #000;
55
margin: 0;
6+
touch-action: manipulation;
7+
-webkit-touch-callout: none;
8+
-webkit-user-select: none;
9+
-khtml-user-select: none;
10+
-moz-user-select: none;
11+
-ms-user-select: none;
12+
user-select: none;
613
}
714

815
/* Mobile flexbox container for lyrics */
@@ -18,6 +25,8 @@ body {
1825
bottom: 0;
1926
z-index: 5;
2027
pointer-events: none;
28+
max-width: 100vw;
29+
max-height: 100vh;
2130
}
2231

2332
svg {

js/secrets.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -300,17 +300,12 @@ function setup() {
300300
var isOtherMediaQuery = window.matchMedia("only screen and (min-width:1080px)").matches;
301301
if(isMobile && !isOtherMediaQuery) {
302302
svgSize = 250;
303-
padding = 40;
303+
padding = 20;
304304
}
305305

306306
var rows = Math.floor(height / svgSize) + 1.5; // Add 1.5 rows: 1 full + 0.5 for 1/4 cutoff
307307
rows = Math.ceil(rows); // Round up to ensure we have enough rows
308308
var cols = Math.floor(width / svgSize) + 1; // Add extra column for better coverage
309-
310-
// Add one more column for mobile devices
311-
if(isMobile && !isOtherMediaQuery) {
312-
cols += 1;
313-
}
314309
var radius = Math.floor(Math.max(width, height) / Math.max(rows, cols)) / 2;
315310

316311
shapes = makeFlowers(radius);
@@ -390,7 +385,7 @@ function pickFlower(flowers) {
390385
var colors = ['tomato', 'orangered', 'floralwhite',
391386
'gold', 'red', 'darkorange'];
392387
colors = ['DARKMAGENTA', 'REBECCAPURPLE', 'SLATEBLUE', 'ROYALBLUE', '#9c27b0', '#9f9fff',
393-
'ALICEBLUE', 'PLUM', 'CORNFLOWERBLUE', 'DARKBLUE', 'MEDIUMBLUE', 'DARKSLATEBLUE'];
388+
'PLUM', 'CORNFLOWERBLUE', 'DARKBLUE', 'MEDIUMBLUE', 'DARKSLATEBLUE'];
394389
var color = colors[Math.floor(Math.random() * colors.length)];
395390
flower.rotation = (Math.PI / 2) * (Math.floor(Math.random() * 12) / 12);
396391
flower.stroke = color;

secrets.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99

1010
gtag('config', 'UA-72294820-1');
1111
</script>
12-
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
13-
<meta content="utf-8" http-equiv="encoding">
14-
<title>Secrets</title>
12+
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
13+
<meta content="utf-8" http-equiv="encoding">
14+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
15+
<title>Secrets</title>
1516
<link href="./css/secrets.css" rel="stylesheet">
1617
<script src="./js/two.js"></script>
1718
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

0 commit comments

Comments
 (0)