Explorar el Código

scroll to top to close back the card

master
farhan hace 4 meses
padre
commit
ca46cd1f11
Se han modificado 1 ficheros con 10 adiciones y 1 borrados
  1. 10
    1
      resources/js/app.js

+ 10
- 1
resources/js/app.js Ver fichero

@@ -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 = {

Loading…
Cancelar
Guardar