Browse Source

scroll to top to close back the card

master
farhan 4 months ago
parent
commit
ca46cd1f11
1 changed files with 10 additions and 1 deletions
  1. 10
    1
      resources/js/app.js

+ 10
- 1
resources/js/app.js View File

171
     }
171
     }
172
 
172
 
173
     // Listen for click or touch event to start auto-scrolling
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
      // Intersection Observer for fading in elements
185
      // Intersection Observer for fading in elements
177
     const observerOptions = {
186
     const observerOptions = {

Loading…
Cancel
Save