Quellcode durchsuchen

scroll to top to close back the card

master
farhan vor 4 Monaten
Ursprung
Commit
ca46cd1f11
1 geänderte Dateien mit 10 neuen und 1 gelöschten Zeilen
  1. 10
    1
      resources/js/app.js

+ 10
- 1
resources/js/app.js Datei anzeigen

@@ -171,7 +171,16 @@ document.addEventListener('DOMContentLoaded', function() {
171 171
     }
172 172
 
173 173
     // Listen for click or touch event to start auto-scrolling
174
-    window.addEventListener('click', handleInteraction, { once: true });
174
+    window.addEventListener('click', handleInteraction);
175
+
176
+    window.addEventListener('scroll', function() {
177
+        if (window.pageYOffset === 0) {
178
+            audioElement.pause();
179
+            document.getElementById('petalOverlay').style.display = 'none';
180
+            hasPlayed = false; // Reset to allow replay
181
+            document.body.classList.add('no-scroll');
182
+        }
183
+    });
175 184
 
176 185
      // Intersection Observer for fading in elements
177 186
     const observerOptions = {

Laden…
Abbrechen
Speichern