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