git.lucas.co / website
source for lucas.co

commitf4ac513ba6d3321dfb93ec3907cd895783c68b36
parent99834469cc
authorlsgalante <lsgalante12@gmail.com>
date2025-05-14 21:45
try again

 border.js | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/border.js b/border.js
index 9571836..fbf2fba 100644
--- a/border.js
+++ b/border.js
@@ -1,5 +1,5 @@
 onStart();
-
+console.log("test");
 //
 //
 //
@@ -9,8 +9,18 @@ onStart();
     // }
 // })
 // resizeOberver.observe(document.documentElement);
-window.addEventListener("scroll", canvasClear);
-window.addEventListener("scroll", canvasInit);
+let lastHeight = window.innerHeight;
+window.addEventListener("scroll", function() {
+    console.log("test")
+    setTimeout(function() {
+        if (window.innerHeight != lastHeight) {
+            lastHeight = window.innerHeight;
+            console.log("test");
+            canvasClear();
+            canvasInit();
+        }
+    }, 100);
+})
 
 function onStart() {
     const canvas = document.createElement("canvas");
@@ -40,6 +50,7 @@ function canvasClear() {
 }
 
 function canvasInit() {
+    console.log("test");
     const canvas = document.getElementById("borderCanvas");
 
     // set size in css pixels