Note that there are some explanatory texts on larger screens.

plurals
  1. POIssues with simple jQuery image gallery with Colorbox plugin
    text
    copied!<p>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 <em>img#bigpic</em> - the link to the image does appear to be updating correctly.</p> <p>Here's the jQuery I have:</p> <pre><code>$(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'); }); }); </code></pre> <p>...and the HTML</p> <pre><code>&lt;a href="_images/products/large/bpn0001_1.jpg" id="largeimage"&gt;&lt;span&gt;&lt;/span&gt;&lt;img src="_images/products/bpn0001_1.jpg" id="bigpic" /&gt;&lt;/a&gt; &lt;div class="thumbnails"&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="_images/products/bpn0001_1.jpg" rel="_images/products/large/bpn0001_1.jpg"&gt;&lt;img src="_images/products/mini/bpn0001_1.jpg" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="_images/products/bpn0001_2.jpg" rel="_images/products/large/bpn0001_2.jpg"&gt;&lt;img src="_images/products/mini/bpn0001_2.jpg" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="_images/products/bpn0001_3.jpg" rel="_images/products/large/bpn0001_3.jpg"&gt;&lt;img src="_images/products/mini/bpn0001_3.jpg" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>Any help would be much appreciated!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload