Skip to content

Commit

Permalink
Update index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
kpsvdp authored Dec 15, 2023
1 parent 9c77aa4 commit c7ef4d6
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@
<source src="Music/index.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
<!-- Existing Scripts -->
<script src="assets/js/jquery.min.js"></script>
<!-- ... -->

<!-- Additional Script for Audio Playback Control -->
<script>
document.addEventListener('DOMContentLoaded', function() {
var audioElem = document.querySelector('audio');

// Play audio on desktop without user interaction
if (!window.matchMedia('(pointer: coarse)').matches) {
audioElem.play();
}

// For mobile and tablet, play audio after a user interaction
document.addEventListener('touchstart', function() {
audioElem.play();
});
});
</script>
</head>
<body class="is-preload">

Expand Down Expand Up @@ -100,4 +120,4 @@ <h3> Give Us Your Feedback</h3>
<script src="assets/js/main.js"></script>

</body>
</html>
</html>

0 comments on commit c7ef4d6

Please sign in to comment.