sisko sisko - 1 year ago 144
jQuery Question

Jquery lightbox popup issue

I am using the following code to dynamically set a href link to open up some content as a lightbox.

$(document).ready(function() {

$(".views-field-nid-1 > .field-content > a").each(

$(this).attr("rel", "lightframe[|width:1100px; height:700px;]");
return true;


The problem I am having is that the links dont work unless you click on them twice and I can't explain why except to guess there are 2 such links on my webpage.

To help put things in perspective, please visit Click on the Enlarge Floorplan links on the right hand on the page. There is one such button for each of the floorplans on display.

I hope someone can help me with this issue!?!.enter image description here

Answer Source

Why didn't you add the rel with a loop:

$(".views-field-nid-1 > .field-content > a").each(function(index) {
    $(this).attr("rel", "lightframe[|width:1100px; height:700px;]");

And after that use your lightbox without problem and without needing a double click?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download