我对Javascript还是陌生的,所以请客气。我的html中有几个单独的页面。导航有6个链接(主页,音乐,关于,演出,歌词,联系方式。导航主页嵌入了youtube vid。还有一个导航音乐页面,其中包含5张专辑/ cd,每个都有其自己的播放列表/音频播放器。页面更改后如何停止播放视频和/或音频?
$(document).ready(function() {
$('#home').load('home.html');
$('#music').load('player.html');
$('#about').load('about.html');
$('#gigs').load('gigs.html');
$('#contact').load('contact.html');
});
<nav>
<div class="hambtn" onclick="openNav()">☰</div>
<div id="sidenav" class="menu">
<a href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<a href="#home">home</a>
<a href="#music">music</a>
<a href="#about">about</a>
<a href="#gigs">gigs</a>
<a href="#contact"><span>contact</span></a>
</div>
</nav>
<section>
<article>
<div id="home"></div>
<div id="music"></div>
</article>
</section>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>6-24_jj utube responsive</title>
<style type="text/css">
#utube{
margin:0 auto;
width:80%;
height:auto;
}
.video-responsive{
overflow:hidden;
padding-bottom:56.25%;
position:relative;
height:0;
}
.video-responsive iframe{
left:0;
top:0;
height:100%;
width:100%;
position:absolute;
}
</style>
</head>
<body>
<div id="utube" class="video-responsive"><iframe width="560" height="315" src="https://www.youtube.com/embed/ScMzIvxBSi4?rel=0" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>
</body>
</html>
答案 0 :(得分:0)
您可以使用暂停音频或视频 。暂停() 并播放音频或视频 .play()