LightBox2 within an IFrame, Quick and Dirty

Posted by b.vandgrift Sat, 21 Mar 2009 23:21:00 GMT

having been challenged by one of my cofounders at FlowMingle, I took the javascript library for LightBox2 by lokesh dhakar, and modified it such that it would work from within an iframe.

this requires breaking the library into two copies, with functionality added and removed from each. i called these parent_lb.js and child_lb.js for clarity, as well as parent.html and child.html.

the parent lb code isn’t much modified, however the child requires replacing all of the $() shortcut prototype calls with calls to the parent document, wrapped in an Element.extend() call from Prototype.js.

you can download the example here if you like. It’s very q/d, so feel free to improve on it. i’ll keep updating the archive as it gets cleaner. mail me any results that’re interesting.

Trackbacks

Use the following link to trackback from your own site:
http://ben.vandgrift.com/trackbacks?article_id=10