I'm putting together an image gallery for an ecommerce site and wanting to use colorbox to launch larger images. My problem is that image launched in colorbox stays as the first one launched and should reflect the image shown as img#bigpic - the link to the image does appear to be updating correctly.
Here's the jQuery I have:
$(document).ready(function(){
$("#largeimage").colorbox();
imageSwapper(".thumbnails a");
function imageSwapper(link) {
$(link).click(function(){
$("#bigpic").attr("src", this.href);
$("#largeimage").attr("href", this.rel);
return false;
});
};
$("#largeimage").bind('mouseenter mouseleave', function(event) {
$("#largeimage span").toggleClass('showspan');
});
});
...and the HTML
<a href="_images/products/large/bpn0001_1.jpg" id="largeimage"><span></span><img src="_images/products/bpn0001_1.jpg" id="bigpic" /></a>
<div class="thumbnails">
<ul>
<li><a href="_images/products/bpn0001_1.jpg" rel="_images/products/large/bpn0001_1.jpg"><img src="_images/products/mini/bpn0001_1.jpg" /></a></li>
<li><a href="_images/products/bpn0001_2.jpg" rel="_images/products/large/bpn0001_2.jpg"><img src="_images/products/mini/bpn0001_2.jpg" /></a></li>
<li><a href="_images/products/bpn0001_3.jpg" rel="_images/products/large/bpn0001_3.jpg"><img src="_images/products/mini/bpn0001_3.jpg" /></a></li>
</ul>
</div>
Any help would be much appreciated!