<script> document.getElementById('listen-btn').addEventListener('click', function() { document.getElementById('music-player').play(); });
<script> $(window).scroll(function() { if($(window).scrollTop() > 1400) document.querySelector('#music-player').pause(); }); </script>
The button starts the audio player and scrolls to the section where the audio player is displayed. When you scroll the next section, the audio player stops after scrolling 1400, but I need this to be relative. How to make 1400 percent (50%)
source share