Displaying larger image, Jquery help please!
http://militarypewter.com/?page_id=308 <--- URL of my project
Image on right is my battle. when click a thumbnail it shows into the 'displayImg'
What I need is when click displayImg -> go to HREF of image that is currently displayed.
Sounds like it'd be easy but its not im a Jquery noob. PLEASE HELP! It will be greatly appreciated!
heres the code:
Script :
$(document).ready(function(){
//Larger thumbnail preview
$("ul.thumb li").hover(function() {
$(this).css({'z-index' : '10'});
$(this).find('img').addClass("hover").stop()
.animate({
marginTop: '-60px',
marginLeft: '-60px',
top: '50%',
left: '50%',
width: '75px',
height: '75px',
padding: '20px'
}, 200);
} , function() {
$(this).css({'z-index' : '0'});
$(this).find('img').removeClass("hover").stop()
.animate({
marginTop: '0',
marginLeft: '0',
top: '0',
left: '0',
width: '50px',
height: '50px',
padding: '5px'
}, 400);
});
//Swap Image on Click
$("ul.thumb li a").click(function() {
var mainImage = $(this).attr("href"); //Find Image Name
$("#main_view img").attr({ src: mainImage });
return false;
});
});
HTML:
<div id="main_view" class="gradient-container">
<a href="images/products/<?php echo $displayImg ?> "><img height="200px" src="images/products/<?php echo $displayImg ?>.jpg" alt="" /></a>
</div>