17 lines
487 B
JavaScript
17 lines
487 B
JavaScript
|
const btn = document.querySelector(".btn");
|
||
|
const video = document.querySelector(".background-video");
|
||
|
const fa = document.querySelector(".fa");
|
||
|
|
||
|
btn.addEventListener("click", () => {
|
||
|
if (btn.classList.contains("pause")) {
|
||
|
btn.classList.remove("pause");
|
||
|
video.play();
|
||
|
fa.classList.add("fa-pause");
|
||
|
fa.classList.remove("fa-play");
|
||
|
} else {
|
||
|
btn.classList.add("pause");
|
||
|
video.pause();
|
||
|
fa.classList.remove("fa-pause");
|
||
|
fa.classList.add("fa-play");
|
||
|
}
|
||
|
});
|