106
reputation
4

X9DESIGN

Here You have version for multiple instances of audio player.

HTML

<a href="javascript:void(0)" onclick="aud_play_pause(this)">
    <i class="control icon-play"></i>
    <audio class="xnine-player" src="/path/to/file#1.mp3" preload="auto"></audio>
</a>

<a href="javascript:void(0)" onclick="aud_play_pause(this)">
    <i class="control icon-play"></i>
    <audio class="xnine-player" src="/path/to/file#2.mp3" preload="auto"></audio>
</a>

JAVASCRIPT

<script>
    function aud_play_pause(object) {
        var myAudio = object.querySelector(".xnine-player");
        var myIcon = object.querySelector(".control");
        if (myAudio.paused) {
            myIcon.className = "control icon-pause";
            myAudio.play();
        } else {
            myIcon.className = "control icon-play";
            myAudio.pause();
        }
    }
</script>

...

0
answers
1
question
~2k
people reached
  • Poland
  • Member for 1 year, 5 months
  • 6 profile views
  • Last seen Nov 15 '18 at 5:45

Top tags (3)

Score 0
Posts 1
Score 0
Posts 1
Score 0
Posts 1

Top posts (1) All Questions Answers | Votes Newest

Badges (4)

Gold

Silver

Bronze

4

Rarest