Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery on thumbnail click replace second img src with thumbnail src
    primarykey
    data
    text
    <p><a href="http://jsfiddle.net/yKTyz/18/" rel="nofollow">JSFIDDLE HERE</a> On pressing a <code>.miniimg/2/3</code> it should replace the src of an img classed <code>.presentimg</code> which i have appended using jquery to the div <code>.imgcontainer</code>, I have been through the jQuery <em>(BELOW HTML)</em> and the only reason i think it wont work because of the fact i have used a function within a function and i do not know an alternative method</p> <pre><code>&lt;div class="imgcontainer"&gt; &lt;div class="minicontainer"&gt; &lt;img src="http://lh3.googleusercontent.com/_Zuzii37VUO4/Ta0nUeMwXoI/AAAAAAAAFoc/7f0Um7OTgNg/s000/Antartic-by-Peter-Rejcek.jpg" title="icy mountains" class="miniimg"/&gt; &lt;img src="http://lh3.googleusercontent.com/_Zuzii37VUO4/Ta0nUFUhg6I/AAAAAAAAFoY/GToUxRYcteY/s000/Antartic-by-Kelly-Speelman.jpg" title="icy planes and hills" class="miniimg2"/&gt; &lt;img src="http://lh4.googleusercontent.com/_Zuzii37VUO4/Ta0nTs8AbPI/AAAAAAAAFoU/zCvNKv4kfe4/s000/BeachWaves-By-RePublicDomain.jpg" title="sun rise with clouds" class="miniimg3"/&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>The jquery, in the jquery I use (index) for the outer .each function as i saw it on a forum but i dont not know if that actually works unfortuately</p> <pre><code>$(".imgcontainer").each(function(){ var imgsrc = $(".minicontainer img:first-child").attr("src"); $(this).append('&lt;img src="'+imgsrc+'" class="presentimg"/&gt;'); }); $(".miniimg").each(function(index){ var $this = $(this); $(this).click(function(){ var miniimgrc = $this.attr("src"); $(".presentimg").atrr('src', miniimgrc); }); }); $(".miniimg2").each(function(index){ var $this = $(this); $(this).click(function(){ var miniimgrc2 = $this.attr("src"); $(".presentimg").atrr('src', miniimgrc2); }); }); $(".miniimg3").each(function(index){ var $this = $(this); $(this).click(function(){ var miniimgrc3 = $this.attr("src"); $(".presentimg").atrr('src', miniimgrc3); }); }); </code></pre>
    singulars
    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.
 

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