I have a recurring function in my code, which consists of a set of thumbnails that, when clicked, plays a unique video. The video is in a div that's toggled. HTML is included for reference:
HTML
<ul class="testimonialthumbs">
<li id="t1"><img></li>
<li id="t2"><img></li>
<li id="t3"><img></li>
<li id="t4"><img></li>
<li id="t5"><img></li>
</ul>
<hr>
<div class="testimonialdrop" id="v1">
<iframe></iframe>
<hr>
</div>
<div class="testimonialdrop" id="v2">
<iframe></iframe>
<hr>
</div>
<div class="testimonialdrop" id="v3">
<iframe></iframe>
<hr>
</div>
<div class="testimonialdrop" id="v4">
<iframe></iframe>
<hr>
</div>
<div class="testimonialdrop" id="v5">
<iframe></iframe>
<hr>
</div>
JS
$('#t1').click(function(){
$('#v1').slideToggle('fast');
$('#v2,#v3,#v4,#v5').hide();
});
$('#t2').click(function(){
$('#v2').slideToggle('fast');
$('#v1,#v3,#v4,#v5').hide();
});
$('#t3').click(function(){
$('#v3').slideToggle('fast');
$('#v1,#v2,#v4,#v5').hide();
});
$('#t4').click(function(){
$('#v4').slideToggle('fast');
$('#v1,#v2,#v3,#v5').hide();
});
$('#t5').click(function(){
$('#v5').slideToggle('fast');
$('#v1,#v2,#v3,#v4').hide();
});
What is a more efficient way to write the JS above? The end result is that when #t(n) is clicked, #v(n) will expand and every other #v(n) will collapse (if expanded). The default display: on #v(n) is none.