Answer the question
In order to leave comments, you need to log in
Why doesn't Mozilla want to work?
HTML code:
<div id="playerBox">
<audio id="player" src="audio/music-1.mp3"></audio>
<div class="playerImgBox">
<img class="playerImg" src="img/album-1.jpg" alt="" />
</div>
<div class="playerControls">
<button class="play"></button>
</div>
</div>
document.getElementById("player").onloadedmetadata = function(){
var
$player = this,
$parent = this.parentNode,
$play = $parent.getElementsByClassName("play")[0],
$run = false;
$play.onclick = function(){
if($run){
$player.pause();
$run = false;
} else {
$player.play();
$run = true;
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question