File tree 1 file changed +8
-10
lines changed
1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -79,16 +79,14 @@ document.addEventListener("DOMContentLoaded", function () {
79
79
flowerBasketGallery . style . display = "block" ;
80
80
} ) ;
81
81
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
+ }
92
90
93
91
// Window scroll event for timeline animation
94
92
window . addEventListener ( "scroll" , animateTimeline ) ;
You can’t perform that action at this time.
0 commit comments