Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery code stops functioning after button is clicked (in firefox, ie, safari, but NOT in chrome)
    primarykey
    data
    text
    <p>I have made a lightbox-style gallery using jquery: <a href="http://jsfiddle.net/ncD9H/" rel="nofollow">http://jsfiddle.net/ncD9H/</a> What works in this fiddle and chrome does not work on any other browser. </p> <p>I have thumbnails inside <code>&lt;a&gt;</code> tags:</p> <pre><code>&lt;div id="gallery"&gt; &lt;a class="trigger" href="images/fulls/01.jpg"&gt; &lt;img class="thumb" src="images/thumbs/01.jpg"&gt; &lt;/a&gt; &lt;a class="trigger" href="images/fulls/02.jpg"&gt; &lt;img class="thumb" src="images/thumbs/02.jpg"&gt; &lt;/a&gt; &lt;a class="trigger" href="images/fulls/03.jpg"&gt; &lt;img class="thumb" src="images/thumbs/03.jpg"&gt; &lt;/a&gt; &lt;/div&gt; </code></pre> <p>And when I click the thumbnail, it switches to the fullview with the following jquery script:</p> <pre><code>$('.trigger').click(function(e){ e.preventDefault(); $('.lightbox').fadeIn(200); $('#main').foggy(); var imageSource =$(this).attr('href'); $('.lightbox&gt;img').attr('src',imageSource); }); </code></pre> <p>The fullview is switched off when the full image is clicked on:</p> <pre><code>$('.lightbox&gt;img').click(function(){ $('.lightbox').fadeOut(200); $('#main').foggy(false); }); </code></pre> <p>When I click a thumbnail and open the fullview, and then click the full image to exit lightbox, <code>$('.trigger').click(function(e){ ...});</code> does not work at all. When I click a thumbnail a second time, the browser just navigates to the full image. </p> <p>So I've tried the following: I've refreshed the page, clicked a thumbnail to open the fullview, then exited the full view by clicking the picture again. Then, in the console, I've typed:</p> <pre><code>$('.trigger').click(function(e){ e.preventDefault(); }); </code></pre> <p>When I clicked the thumbnail again, the browser did nothing, as dictated by the function. But I am guessing that this means the original function, for some reason, becomes inaccessible for a second clicking. Why does this happen, why does it work on chrome, and how can I fix it?</p> <p>Note: foggy() is a jquery plugin that blurs the background.</p>
    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.
    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