0
在早些時候的幫助下,我解決了我的視頻播放器關於通過點擊播放視頻的問題,但我無法弄清楚如何在點擊時隱藏播放按鈕覆蓋。任何幫助將不勝感激。如何在HTML5視頻中隱藏播放按鈕覆蓋
HTML
<div class="video-wrapper">
<video class="video" id="bVideo" loop controls>
<source src="https://www.w3schools.com/html/mov_bbb.mp4" type="video/mp4" />
</video>
<div class="playButton" onclick="playPause()"></div>
</div>
腳本
var bunnyVideo = document.getElementById("bVideo");
function playPause() {
if (bunnyVideo.paused)
{
bunnyVideo.play();
$(".playButton").toggle();
}
else
{
bunnyVideo.pause();
$(".playButton").toggle();
}
}
bunnyVideo.addEventListener("click", playPause, false);
https://jsfiddle.net/gtoscano/ed9o52k5/2/
謝謝你,完美工作 –