Skip to main content
X9DESIGN's user avatar
X9DESIGN's user avatar
X9DESIGN's user avatar
X9DESIGN
  • Member for 7 years, 4 months
  • Last seen more than 7 years ago
About

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>

...

Badges
This user doesn’t have any gold badges yet.
This user doesn’t have any silver badges yet.
4
bronze badges
Top tags
0
Score
2
Posts
100
Posts %
0
Score
1
Posts
50
Posts %
0
Score
1
Posts
50
Posts %
0
Score
1
Posts
50
Posts %
Top posts