The code below is to show and hide the contents of a div
.
I'm trying to use it to show some videos, but I can not make it show more than 2 videos.
See the code:
Html
<button id="opt1">Option 1</button>
<button id="opt2">Option 2</button>
<div class="yesDisplay">
<p>Video 01</p>
<iframe width="560" height="315" src="https://www.youtube.com/embed/6AmRg3p79pM?controls=0&showinfo=0"frameborder="0" allowfullscreen></iframe>
</div>
<div class="noDisplay">
<p>Video 02</p>
<iframe width="560" height="315" src="https://www.youtube.com/embed/6AmRg3p79pM?controls=0&showinfo=0"frameborder="0" allowfullscreen></iframe>
</div>
CSS
.noDisplay{display:none;}
.yesDisplay{display:block;}
SCRIPT
$('#opt1').click(function(){
$('.yesDisplay').show();
$('.noDisplay').hide();
});
$('#opt2').click(function(){
$('.yesDisplay').hide();
$('.noDisplay').show();
});
I'd like to show up to 8 videos on it, and when you click on a button the other hides. If possible do this with JavaScript.