M
M
Muxammadislom Eshonqulov2021-07-16 10:10:28
JavaScript
Muxammadislom Eshonqulov, 2021-07-16 10:10:28

Wordpress audio player add action on click on play and back?

Good time.
What I'm trying to do: Added an audio track but when you click on (pause ||) the modal window should exit, when the modal window is closed the audio track should continue.
Unable to display modal window
html structure

<div class="mejs-button mejs-playpause-button mejs-play"><button type="button" aria-controls="mep_0" title="Воспроизвести" aria-label="Воспроизвести" tabindex="0"></button></div>

If I put this code on the console everything works. But if I transfer to a file it doesn't work.
$('.mejs-button buttom').click(function () {
        console.log('Hello');
    });

Thanks for the answer.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
TheOnlyFastCoder2, 2021-07-16
@TheOnlyFastCoder2

<div>
  <audio id="audio" controls>
   <source type="audio/mp3" src="https://dnl.megapesni.com/get/online/EWdZCiMIEXxZ3O4cLtOqLg/1626470796/ae17d566/2021/05/Galibri & Mavik - Федерико Феллини.mp3">
 </audio>
</div>
<button id="button"> clickMe </button>

button.onclick = () => {
    if( audio.paused === false ) {
      audio.pause()
      alert("audio остановлено")
    }
    else {
      audio.play()
      alert("audio продолжено")
    }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question