For my use case I wanted to have a lightbox appear automatically as soon as the page loaded. To do this I needed to go through the following rigmarole:

      var destination = $('<a id="not-done-yet" href="http://live.tcktcktck.org/not-done-yet/index.html" rel="lightframe[|width:790; height:495; scrolling:none;]" style="display:no;">&nbsp;</a>');
      $(destination).appendTo('body');
      $(document).ready(function() {
        $('#not-done-yet').triggerHandler('click');
      });

We need to create a DOM node, attach it to the document, lightbox binds to it when it loads, then we can trigger the click. This would be even harder to do if you wanted to load a lightbox after the document has been loaded.

This is really clunky. It would be much more elegant just to do something like:

  Lightbox.create("http://live.tcktcktck.org/not-done-yet/index.html", "lightframe", NULL, "width:790; height:495; scrolling:no;");

The NULL argument would be for the group. Or maybe this might be better:

  Lightbox.group[1234] = [
    {
      uri:"http://live.tcktcktck.org/not-done-yet/index.html",
      type: "lightframe",
      properties: "width:790; height:495; scrolling:no;"
    },
    {
      uri:"another/page.html",
      type: "lightframe",
      properties: "width:790; height:495; scrolling:no;"
    }
  ];
  Lightbox.create(1234);

Comments

dalin’s picture

Status: Active » Closed (duplicate)
dalin’s picture