Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamic Links and jQuery Lightbox issue : Loading image in lightbox...completely stumped!
    primarykey
    data
    text
    <p>I have a function that dynamically creates links for a photo gallery. The function also produces a larger image as a background image of a div when and thumbnail is clicked on. What I want to do is have a third event, where if the user clicks the enlarged image in the div, the jQuery Fancybox loads an even bigger version of the image being displayed in the div. The problem is that the link for the anchor tag I'm using is created dynamically, and I know that Fancybox parses the HTML when the DOM is ready...unfortunately my function changes the DOM by appending the anchor tag for the full sized image. The help I need is using the Fancybox's options to specify the href attribute for the plugin. I'm sorry that was so long-winded...here's the code.</p> <p>jQuery:</p> <pre><code>function gallery(picid, picnum){ var ext = 'jpg'; var fullSize = 'imgs/'+picid+'_full.'+ext; $('#photolarge').css("background", 'url(imgs/'+picid+'_large.'+ext+') no-repeat'); $('#photolarge a').attr( { href: fullSize //rel: 'lightbox', } ); $("#lightboxlink").click(function(){ $('#lightboxlink').fancybox({ 'autoDimensions' : false, 'width' : 'auto', 'height' : 'auto', 'href' : fullSize }); }); return false; </code></pre> <p>}</p> <p>HTML Snippet </p> <pre><code>&lt;div id="photolarge"&gt; &lt;a id="lightboxlink" href="#"&gt;&lt;/a&gt; &lt;/div&gt; &lt;div id="phototable"&gt; &lt;ul id="photorow1"&gt; &lt;li&gt;&lt;a onclick="gallery('bigsun',1)"&gt;&lt;img id="sun" src="imgs/bigsun.jpg" /&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>Subsequent CSS:</p> <pre><code>#photolarge { width: 590px; height: 400px; margin-left: 7px; border: 2px solid; background: none;} #phototable { width: 590px; height: 300px; border: 2px solid; margin: 10px 0 0 7px;} #phototable img { cursor: pointer;} #phototable ul { list-style: none; display: inline;} #phototable li { padding-left: 10px;} #lightboxlink { display: block; height: 100%; width: 100%;} </code></pre> <p>Any help would be greatly appreciated!!!</p>
    singulars
    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