+ 3

Can you make the music on here for me because I dont know how.

https://code.sololearn.com/WVMncI8CbKw5/?ref=app

1st Feb 2021, 7:18 PM
Jordan Kinney
Jordan Kinney - avatar
3 Answers
+ 2
Add this to your JS tab and it should work. It worked when I tested. document.addEventListener('DOMContentLoaded', function() { var continueButton = document.querySelector('.swal-button--confirm'); var audio = new Audio(); audio.loop = true; // repeat the music after it finishes. audio.src = 'https://www.dropbox.com/s/mza0ghu4z3czbbn/Software%20Developer%20Short%20Film%20-%20Bgm.mp3?dl=1'; function playMusic() { audio.play(); } continueButton.addEventListener('click', playMusic); });
2nd Feb 2021, 6:45 PM
Josh Greig
Josh Greig - avatar
+ 3
Josh Greig I want it to play when you press it
2nd Feb 2021, 5:58 PM
Jordan Kinney
Jordan Kinney - avatar
0
I'm not sure what you mean by "make the music on here". You just want some audio playing in the background? Do you want the music to repeat after it finishes playing?
2nd Feb 2021, 3:36 PM
Josh Greig
Josh Greig - avatar