flashLightBoxInjector 1.2 and Lightbox 2.0.4

bridgedGap2It has been brought to my attention that the release of Lightbox 2.0.4 broke some stuff in flashLightBoxInjector 1.2. After investigating the issue, it turns out that one (1) tiny change to the lightbox.js file is needed in order to get flashLightBoxInjector working with Lightbox 2.0.4.

In Lightbox 2.0.4 Lokesh (the author of Lightbox) decided to create the Lightbox instance without storing it into a variable. As flashLightBoxInjector relies on that variable, things broke. Now, to fix this follow this tiny procedure and it’ll work just fine, as it did with version 2.0.3:

  1. Open lightbox.js with your favorite texteditor
  2. Scroll down to the very last line where it reads [js]document.observe(‘dom:loaded’, function () { new Lightbox(); });[/js]
  3. Replace that line with this [js]document.observe(‘dom:loaded’, function () { myLightbox = new Lightbox(); });[/js]
  4. Save your file and … that’s it 🙂

I’ve changed the online example and flashLightBoxInjector 1.2 download and demos here on bram.us to include that change, so you can roll with it “out of the box”. Above that I’ve mailed Lokesh about this issue, hoping to see the variable reappear in a next release.

Published by Bramus!

Bramus is a frontend web developer from Belgium, working as a Chrome Developer Relations Engineer at Google. From the moment he discovered view-source at the age of 14 (way back in 1997), he fell in love with the web and has been tinkering with it ever since (more …)

Join the Conversation

3 Comments

  1. There is no need to change lightbox.js.I just change mylightbox to lightbox and fixed problem

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.