Skip to content

Commit 1533579

Browse files
authored
Merge pull request #482 from Mayukh-Mandal2005/audio-controls-improvement
Improved the audio controls on mantra-audio page
2 parents 2ad2034 + 8b33cb9 commit 1533579

1 file changed

Lines changed: 22 additions & 7 deletions

File tree

morning-mantra-audio.html

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
}
2424
.scroll-top-btn {
2525
position: fixed; /* Fixed position */
26-
bottom: 30px;
27-
right: 30px;
26+
bottom: 30px;
27+
right: 30px;
2828
background-color: #330867;
2929
color: white;
3030
border: none;
@@ -320,7 +320,7 @@ <h2>Soothing Krishna Chants</h2>
320320
Krishna. Feel the positive energy and tranquility with each mantra.
321321
</p>
322322
<div class="audioBtnDiv">
323-
<audio controls>
323+
<audio class="mantra-audio" controls>
324324
<source
325325
src="./audios/Soothing-Krishna-Chants.mp3"
326326
type="audio/mpeg"
@@ -345,7 +345,7 @@ <h2>Morning Bliss</h2>
345345
serenity. Let the divine vibrations guide you through your day.
346346
</p>
347347
<div class="audioBtnDiv">
348-
<audio controls>
348+
<audio class="mantra-audio" controls>
349349
<source src="./audios/morning-bliss.mp3" type="audio/mpeg" />
350350
Your browser does not support the audio element.
351351
</audio>
@@ -362,7 +362,7 @@ <h2>Krishna Relaxing Flute</h2>
362362
flute.
363363
</p>
364364
<div class="audioBtnDiv">
365-
<audio controls>
365+
<audio class="mantra-audio" controls>
366366
<source
367367
src="./audios/Krishna-Relaxing-Flute.mp3"
368368
type="audio/mpeg"
@@ -387,7 +387,7 @@ <h2>Radiant Krishna Aarti</h2>
387387
positivity and divine blessings. Enhance your spiritual experience.
388388
</p>
389389
<div class="audioBtnDiv">
390-
<audio controls>
390+
<audio class="mantra-audio" controls>
391391
<source
392392
src="./audios/Radiant-Krishna-Arti.mp3"
393393
type="audio/mpeg"
@@ -409,7 +409,7 @@ <h2>Radiant Krishna Aarti</h2>
409409
<h2>Sri Krishna Ashtakam</h2>
410410
<p>Listen to this powerfull and devine Krishna Ashtakam.</p>
411411
<div class="audioBtnDiv">
412-
<audio controls>
412+
<audio class="mantra-audio" controls>
413413
<source
414414
src="./audios/Sri-Krishna-Ashtakam.mp3"
415415
type="audio/mpeg"
@@ -483,6 +483,21 @@ <h3>Follow Us</h3>
483483
scrollTopBtn.onclick = function () {
484484
window.scrollTo({ top: 0, behavior: "smooth" }); // Smooth scroll to top
485485
};
486+
487+
// Get all audio elements
488+
const audioElements = document.querySelectorAll('.mantra-audio');
489+
490+
audioElements.forEach(audio => {
491+
audio.addEventListener('play', () => {
492+
// Pause all other audio elements when one is played
493+
audioElements.forEach(otherAudio => {
494+
if (otherAudio !== audio) {
495+
otherAudio.pause();
496+
}
497+
});
498+
});
499+
});
500+
486501
</script>
487502
</body>
488503
</html>

0 commit comments

Comments
 (0)