Closed (duplicate)
Project:
Lightbox2
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
19 Dec 2009 at 05:13 UTC
Updated:
19 Dec 2009 at 05:16 UTC
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;"> </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
Comment #1
dalinWhoops, I must've double-clicked.
#663726: Refactor Lightbox.start to allow it to be called ad-hoc
Comment #2
dalinerr.
#663724: Refactor Lightbox.start to allow it to be called ad-hoc