JAYASWAROOP commited on
Commit
bfb567c
·
1 Parent(s): 21bf564

Update audio.js

Browse files
Files changed (1) hide show
  1. audio.js +6 -4
audio.js CHANGED
@@ -5,7 +5,10 @@ document.addEventListener('DOMContentLoaded', function () {
5
  container.addEventListener('click', function () {
6
  const audio = this.querySelector('audio');
7
 
8
- // Hide all other audio elements except the one clicked
 
 
 
9
  movieContainers.forEach(function (otherContainer) {
10
  const otherAudio = otherContainer.querySelector('audio');
11
  if (otherAudio !== audio && !otherAudio.paused) {
@@ -14,8 +17,7 @@ document.addEventListener('DOMContentLoaded', function () {
14
  }
15
  });
16
 
17
- // Toggle the display class of the audio element
18
- audio.classList.toggle('d-none');
19
  if (audio.paused) {
20
  audio.play();
21
  } else {
@@ -23,4 +25,4 @@ document.addEventListener('DOMContentLoaded', function () {
23
  }
24
  });
25
  });
26
- });
 
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');
14
  if (otherAudio !== audio && !otherAudio.paused) {
 
17
  }
18
  });
19
 
20
+ // Play or pause the audio based on its current state
 
21
  if (audio.paused) {
22
  audio.play();
23
  } else {
 
25
  }
26
  });
27
  });
28
+ });