Note that there are some explanatory texts on larger screens.

plurals
  1. POReplace Image SRC On CLick
    primarykey
    data
    text
    <p>I have a WooCommerce setup where I have a gallery. One is big image and others are thumbnails.</p> <p>What I want to do is when someone clicks on the thumbnail, it replaces the big image and the big image comes there at the thumbnail. How do I do that? Any JavaScript guru here to help?</p> <p>Here is the full HTML output.</p> <pre><code>&lt;div class="images product-gallery "&gt; &lt;div class="big_image"&gt; &lt;a title="" href="http://www.domain.com/image001.jpg" itemprop="image" class="woocommerce-main-image zoom"&gt;&lt;img width="300" height="300" alt="" class="attachment-shop_single wp-post-image" src="http://www.domain.com/image001-300x300.jpg"&gt;&lt;/a&gt; &lt;/div&gt; &lt;div class="thumbnails"&gt; &lt;a title="" class="zoom first" href="http://www.domain.com/image002.jpg"&gt;&lt;img width="90" height="90" alt="" class="attachment-shop_thumbnail" src="http://www.domain.com/image002-90x90.jpg"&gt;&lt;div class="numbers"&gt;1&lt;/div&gt;&lt;/a&gt; &lt;a title="" class="zoom" href="http://www.domain.com/image003.jpg"&gt;&lt;img width="90" height="90" alt="" class="attachment-shop_thumbnail" src="http://www.domain.com/image003-90x90.jpg"&gt;&lt;div class="numbers"&gt;2&lt;/div&gt;&lt;/a&gt; &lt;a title="" class="zoom last" href="http://www.domain.com/image004.jpg"&gt;&lt;img width="90" height="90" alt="" class="attachment-shop_thumbnail" src="http://www.domain.com/image004-90x90.jpg"&gt;&lt;div class="numbers"&gt;3&lt;/div&gt;&lt;/a&gt; &lt;a title="" class="zoom first" href="http://www.domain.com/image005.jpg"&gt;&lt;img width="90" height="90" alt="" class="attachment-shop_thumbnail" src="http://www.domain.com/image005-90x90.jpg"&gt;&lt;div class="numbers"&gt;4&lt;/div&gt;&lt;/a&gt; &lt;/div&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>I don't need that <code>&lt;a href="</code> part on image. So, you can ignore them.<br> I have very little knowledge in JavaScript, so please help me out. All I want is when someone click on any of the thumbnail image, the thumbnail image replaces the big image and the big image replace the clicked thumbnail. So basically the alter positions.</p> <p>Please pardon me for my poor English.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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