From 178b73465b54141ec99e96f589a928b089252a88 Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Mon, 29 Jan 2024 17:06:38 -0500 Subject: Position objects more compactly --- script.js | 5 +++-- style.css | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/script.js b/script.js index 6cfcd78..1f401e6 100644 --- a/script.js +++ b/script.js @@ -10,10 +10,11 @@ let rad = 10 // Stroke radius let size = 200 // SVG width and height let A = [] // Objects let cnt = 0 +let rowsize = Math.floor(window.innerWidth / 1.1 / size) document.querySelectorAll("svg").forEach(function(svg) { // Move objects so they aren't overlapping - svg.style.left = 1.5 * size * (cnt % 2) + "px" - svg.style.top = 1.5 * size * Math.floor(cnt / 2) + "px" + svg.style.left = 1.1 * size * (cnt % rowsize) + "px" + svg.style.top = 1.1 * size * Math.floor(cnt / rowsize) + "px" cnt++ let a = { id: svg.id, // Unique ID diff --git a/style.css b/style.css index 0c2ca9d..9a53629 100644 --- a/style.css +++ b/style.css @@ -1,6 +1,5 @@ body { - overflow-y: hidden; - overflow-x: hidden; + overflow: hidden; touch-action: manipulation; } -- cgit v1.2.3-70-g09d2