Spaces:
Running
Running
Commit
·
f5a1a2d
1
Parent(s):
bfb567c
Update audio.js
Browse files
audio.js
CHANGED
@@ -5,9 +5,6 @@ document.addEventListener('DOMContentLoaded', function () {
|
|
5 |
container.addEventListener('click', function () {
|
6 |
const audio = this.querySelector('audio');
|
7 |
|
8 |
-
// Toggle the display of the audio element
|
9 |
-
audio.classList.toggle('d-none');
|
10 |
-
|
11 |
// Pause all other audio elements except the one clicked
|
12 |
movieContainers.forEach(function (otherContainer) {
|
13 |
const otherAudio = otherContainer.querySelector('audio');
|
@@ -17,12 +14,15 @@ document.addEventListener('DOMContentLoaded', function () {
|
|
17 |
}
|
18 |
});
|
19 |
|
20 |
-
//
|
21 |
if (audio.paused) {
|
22 |
audio.play();
|
23 |
} else {
|
24 |
audio.pause();
|
25 |
}
|
|
|
|
|
|
|
26 |
});
|
27 |
});
|
28 |
});
|
|
|
5 |
container.addEventListener('click', function () {
|
6 |
const audio = this.querySelector('audio');
|
7 |
|
|
|
|
|
|
|
8 |
// Pause all other audio elements except the one clicked
|
9 |
movieContainers.forEach(function (otherContainer) {
|
10 |
const otherAudio = otherContainer.querySelector('audio');
|
|
|
14 |
}
|
15 |
});
|
16 |
|
17 |
+
// If audio is paused or not already playing, play it
|
18 |
if (audio.paused) {
|
19 |
audio.play();
|
20 |
} else {
|
21 |
audio.pause();
|
22 |
}
|
23 |
+
|
24 |
+
// Toggle the display of the audio element
|
25 |
+
audio.classList.toggle('d-none');
|
26 |
});
|
27 |
});
|
28 |
});
|