I have a image replacement gallery and when I click a thumbnail a larger image appears in the main div. I wish to click this image and have it play a video, I would like a different video to play for each of the larger images clicked. All videos are on youtube.
Here is the code and script I have so far:
<div class="videogallery">
<img id="largeImg" src="/images/locationbased_largeclicktoplay.jpg" alt="Location-Based Video" />
</div>
<div><hr /></div>
<div class="thumbnails">
<p style="font-size: 14px; font-weight:bold; color:#466ea9;font-family:'Lucida Grande', sans-serif; text-align:left; padding-bottom:10px;">Videos</p>
<p style=" text-align:center;">
<a href="/images/logo_largeclick.jpg" title="Social Media 101 Video">
<img src="/images/logo_small.jpg" border="0" height="61" width="100" style="padding-right:10px;" /></a>
<a href="/images/facebook_large.jpg" title="Facebook Video">
<img src="/images/facebook_small.jpg" border="0" height="61" width="100" style="padding-right:10px;"/></a>
<a href="/images/twitter_largeclicktoplay.jpg" title="Twitter Video">
<img src="/images/twitter_small.jpg"border="0" height="61" width="100" style="padding-right:10px;"/></a>
<a href="/images/youtube_largeclicktoplay.jpg" title="Youtube Video">
<img src="U/images/youtube_s.jpg" border="0" height="61" width="100" style="padding-right:10px;"/></a>
</div>
Here is the script:
<script type="text/javascript">
$(document).ready(function(){
$(".thumbnails a").click(function(){
var largePath = $(this).attr("href");
var largeAlt = $(this).attr("title");
$("#largeImg").attr({ src: largePath, alt: largeAlt });
$("h2 em").html(" (" + largeAlt + ")"); return false;
});
});
Any help is much appreciated!
Thank You.
-Ann
I got it I added a script
and
onclick:to the
imagetagI will probably add a different variable to the script for each thumbmail.