私は再生と一時停止ボタンがあります。再生ボタンをクリックすると再生が一時停止ボタンに変わります。私は私のCSSの私の再生と一時停止のボタンと私のhtmlの頭の中の私のjavascriptを持っている。Javascript再生/一時停止ボタンの表示/非表示
しかし、再生ボタンをクリックすると、一時停止ボタンは表示されません。
<script>
$('#play').on('click', function(event) {
currentPlayingTrack.play();
$('#pause').show();
$('#play').hide();
});
$('#pause').on('click', function(event) {
currentPlayingTrack.pause();
$('#pause').hide();
$('#play').show();
});
</script>
#play, #pause {
width:80px;
height: 80px;
background: transparent;
position: relative;
margin-top: 10px;
display: block;
}
#play {
width: 0;
height: 0;
border-left: 30px solid white;
border-right: 30px solid transparent;
border-top: 30px solid transparent;
border-bottom: 30px solid transparent;
position: absolute;
content: "";
top: 10px;
left: 25px;
}
#pause:before {
width: 10px;
height: 60px;
background: white;
position: absolute;
content: "";
top: 10px;
left: 25px;
}
#pause:after {
width: 10px;
height: 60px;
background: white;
position: absolute;
content: "";
top: 10px;
right: 25px;
}
<div>
<a href="#" id="play"></a>
<a href="#" id="pause" style="display: none;"></a>
</div>
私が間違って何をしているのですか?
プレイリンクが正しく隠していますか? – nnnnnn
それが働いて、私が見つけている唯一のエラーは 'currentPlayingTrack is defined'です。 Fiddle here https://jsfiddle.net/flyinggambit/qju6rjps/ –