对不起,因为我不熟悉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
请检查浏览器控制台是否有错误? –