Skip to content

Commit 94fda85

Browse files
authored
Update forbestwish.js
1 parent 845f5af commit 94fda85

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

forbestwish.js

+8-10
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,14 @@ document.addEventListener("DOMContentLoaded", function () {
7979
flowerBasketGallery.style.display = "block";
8080
});
8181

82-
// Background music autoplay with user interaction
83-
document.addEventListener('click', function startMusic() {
84-
const backgroundMusic = document.getElementById("background-music");
85-
if (backgroundMusic) {
86-
backgroundMusic.play().catch(error => {
87-
console.warn("自動播放被阻止:", error);
88-
});
89-
}
90-
document.removeEventListener('click', startMusic); // Remove listener after first click
91-
});
82+
// Background music autoplay
83+
const backgroundMusic = document.getElementById("background-music");
84+
if (backgroundMusic) {
85+
backgroundMusic.play().catch(error => {
86+
console.warn("自動播放被阻止:", error);
87+
// 这里可以选择提示用户手动播放音乐
88+
});
89+
}
9290

9391
// Window scroll event for timeline animation
9492
window.addEventListener("scroll", animateTimeline);

0 commit comments

Comments
 (0)