REInitialize ColorBox from within iFrame

REInitialize ColorBox from within iFrame

Hi all,

As you no doubt know, a link that is generated on the fly (ie by a JS function) and is supposed to invoke a ColorBox (due to a predefined selector) doesn't work as the link didn't exist when the ColorBox was initialised e.g., you have this in the head:

$(document).ready(function(){
    $(".frmMe").colorbox({iframe:true, innerWidth:1200, innerHeight:640});
}

Then a link generated by JS at a later time (for example triggered by a users click) like:

<a href="blah.php" class="frmMe">Easter Eggs</a>


Whenever I dynamically create a link like the one above, I re-run the line:

"$(".frmMe").colorbox({iframe:true, innerWidth:1200, innerHeight:640});" afterwards to ensure the colorBox functionality works.  Great - that solves the problem.

Now however, I have an instance where a link on a parent page like the above is created from within an iFrame (on the fly using JS)

Unforunately however, I haven't been able to find a way to re-intialize the ColorBox on the parent page from within the iframe to ensure that the new link has ColorBox functionality enabled.

I have tried:

$('.frmMe', parent.document.body).colorbox({iframe:true, innerWidth:1200, innerHeight:640});

but it seems to have no affect and generates no errors (yet this follows the format I use to create the link

on the page which is:

$('#updateBx', parent.document.body).html('<a href="" class="frmMe">Glorious</a>');


Any help would be much appreciated!