HTML
<div class="container">
<div class="video"><iframe width="560" height="315" src="//www.youtube.com/embed/zsYjsgm4Psg" frameborder="0" allowfullscreen></iframe>
</div>
<ul class="list_video">
<li><a href="javascript:load_video('https://www.youtube.com/watch?v=NWHfY_lvKIQ')">Learning from StackOverflow.com</a></li>
<li><a href="javascript:load_video('https://www.youtube.com/watch?v=QZWBtfSBlp8')">Joel Spolsky - StackOverflow.com </a></li>
<li><a href="javascript:load_video('https://www.youtube.com/watch?v=m4ZPBPUA30M')">Jeff Atwood - Stackoverflow.com</a></li>
<li><a href="javascript:load_video('https://www.youtube.com/watch?v=NWHfY_lvKIQ')">Learning from StackOverflow.com</a></li>
<li><a href="javascript:load_video('https://www.youtube.com/watch?v=QZWBtfSBlp8')">Joel Spolsky - StackOverflow.com </a></li>
<li><a href="javascript:load_video('https://www.youtube.com/watch?v=m4ZPBPUA30M')">Jeff Atwood - Stackoverflow.com</a></li>
<li><a href="javascript:load_video('https://www.youtube.com/watch?v=NWHfY_lvKIQ')">Learning from StackOverflow.com</a></li>
<li><a href="javascript:load_video('https://www.youtube.com/watch?v=QZWBtfSBlp8')">Joel Spolsky - StackOverflow.com </a></li>
<li><a href="javascript:load_video('https://www.youtube.com/watch?v=m4ZPBPUA30M')">Jeff Atwood - Stackoverflow.com</a></li>
<li><a href="javascript:load_video('https://www.youtube.com/watch?v=NWHfY_lvKIQ')">Learning from StackOverflow.com</a></li>
<li><a href="javascript:load_video('https://www.youtube.com/watch?v=QZWBtfSBlp8')">Joel Spolsky - StackOverflow.com </a></li>
<li><a href="javascript:load_video('https://www.youtube.com/watch?v=m4ZPBPUA30M')">Jeff Atwood - Stackoverflow.com</a></li>
<li><a href="javascript:load_video('https://www.youtube.com/watch?v=NWHfY_lvKIQ')">Learning from StackOverflow.com</a></li>
<li><a href="javascript:load_video('https://www.youtube.com/watch?v=QZWBtfSBlp8')">Joel Spolsky - StackOverflow.com </a></li>
<li><a href="javascript:load_video('https://www.youtube.com/watch?v=m4ZPBPUA30M')">Jeff Atwood - Stackoverflow.com</a></li>
</ul>
</div>
CSS
.container{
width:800px;
border:2px solid #333;
overflow:hidden;
font-family:arial;
background-color:#000;
}
.video{float:left;}
ul.list_video{float:left;list-style-type:none;margin:0;padding:0;width:240px;overflow-y:scroll;height:315px;}
ul.list_video li{font-size:10pt;}
ul.list_video li a{
display:block;
text-decoration:none;
color:#09C;
padding:3px;
text-align:left;
background-color:#333;
border-bottom:1px solid #000;
}
ul.list_video li a:hover{background-color:#000;}
Javascript + jQuery
function load_video(link){
link = link.replace("https:","");
link = link.replace("watch?v=","embed/");
$('.video').html('<iframe width="560" height="315" src="'+link+'" frameborder="0" allowfullscreen></iframe>')
}
我允许自己制作一个视频列表并单击以更改从 YouTube 解析视频的 iframe URL
这里:http: //jsfiddle.net/XdZm5/2/