對不起,因爲我不熟悉JQuery!我試圖在以下條件的頁面上上傳2個視頻:第一個視頻在頁面加載時自動播放,第二個視頻在頁面加載時隱藏,第一個視頻播放時出現。 這是我做了(知道,我甚至不能使第二視頻消失:/):JQuery:當頁面加載時隱藏第二個視頻,然後在第一個完成播放時顯示第二個視頻
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link href="styles.css" rel="stylesheet" />
<title>Coding Test 3</title>
<script src="jquery-1.11.3.min.js"></script>
<script>
$(document).ready(function() {
$('video#vid2').hide();
$('video#vid1').bind('ended', function() {
$('video#vid2').show()
$('video#vid2').play();
}
})
});
</script>
</head>
<body>
<div id="container">
<header>
<h1>Backin' Up</h1>
</header>
<section>
<p>The Backin' Up Song started with an interview on Kansas TV station KMBC in which a woman describes witnessing an attempted robbery at a Shell gas station.</p>
<p>Autotune the News appropriated the video to produce "Backin' Up Song" which creates a song from the witness's description of events.</p>
<div class="videoWrapper">
<video id="vid1" controls autoplay>
<source src="videos/backinupsong.mp4">
<source src="videos/backinupsong.ogv">
</video>
</div>
<p>"Backin' Up Song" was subsequently covered by Canadian indie band Walk Off the Earth. You can watch it below when the original has finished playing.</p>
<div class="videoWrapper">
<video id="vid2" controls autoplays>
<source src="videos/wotebackinupsong.mp4">
<source src="videos/wotebackinupsong.ogv">
</video>
</div>
</section>
</div>
</body>
</html>
歡迎任何幫助!非常感謝!
你想在結束時隱藏第一個視頻嗎? – Buzinas
看起來非常有效,你確定jQuery加載正確嗎?我不確定它是否確實 – Saar
請檢查瀏覽器控制檯是否有錯誤? –