-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
26 lines (24 loc) · 730 Bytes
/
Copy pathmain.js
File metadata and controls
26 lines (24 loc) · 730 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
document.title = "project-js-12";
// Get Elements From Html
let card = document.querySelector(".card");
let btnOne = document.getElementById("btn_one");
let btnTwo = document.getElementById("btn_two");
// Yanni Is The Best pianist
let audio = new Audio("song.mp4")
setTimeout(() => {
card.style.display = "block";
}, 2000);
btnOne.onclick = function (params) {
audio.play();
card.remove();
console.log("User Want To Play Music.");
};
btnTwo.onclick = function (params) {
card.remove();
console.log("User Don't Want To Play Music.");
};
audio.addEventListener('ended', () => {
console.log("Audio Has Finished Playing.");
console.log("Play It Again");
audio.play();
});