I have some inline content which I would like to move to a lightbox if the module is present.

<a class="mymodule-activator" href="#">Click to activate</a>
<div class="mymodule-hiddendiv">
content
content
content
</div>

I am fairly proficient with jquery, and I can hide the div, and call js functions when someone clicks the a.

Now I want to convert this to lightbox

var content = $("div.mymodule-hiddendiv").html();
give_me_a_lightbox(content);

obviously that last line is wrong - what is the actual function name?

Comments

danielb’s picture

Status: Active » Closed (won't fix)

Alright guys I've given up on lightbox2, don't think it does this sort of thing

stella’s picture

Category: support » feature
Status: Closed (won't fix) » Active

No, it presently doesn't show hidden content on the same page. It is possible to have it open up content from another page on the site however. I do plan on adding the functionality you require, but it's going to be another couple of weeks before I have it finished I think.

Cheers,
Stella

stella’s picture

Status: Active » Fixed

This is implemented in the latest dev release, available later today.

To load a hidden div on the current page, you will need to create a link like:

<a href="/node/123 #myDiv > *" rel="lightmodal">show contents of hidden div with the id "myDiv"</a>

where "/node/123" is the current page. You always need to specify the path of the current page. However, with this method you can also display divs from other pages too.

The code following the path is a jQuery selector. #myDiv > * will place all the content of #myDiv in the lightmodal window. It will not place the <div id="myDiv"></div> tags in the window however.

If you use #myDiv as the jQuery selector then all the content of #myDiv and the div tags themselves will be placed in the lightmodal window.

You can read up more about jQuery selectors at http://docs.jquery.com/Selectors

Cheers,
Stella

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

danielb’s picture

champ

stella’s picture

Released in Lightbox2 6.x-1.9 and 5.x-2.9.

Cheers,
Stella