views:

36

answers:

3

Is there a Javascript component that allows me to simply pass it a string made up of arbitrary HTML (any HTML I wish to use) and will show that HTML in a lightbox?

I've been scouring the internet, searching for examples, but it seems like there simply isn't any component capable of doing this.

Even LightWindow, which claims to be all-purpose, still requires me to attach it to an tag with the href set to an element ID.

This isn't what I want. I want to be able to call a function and pass in the HTML myself.

(Another issue with LightWindow is that it requires scriptaculous as a dependency. The project already uses jQuery, and I'd rather not include two frameworks at once.)

Any ideas?

+1  A: 

You can use jqModal or jQuery UI dialog.

SLaks
+1  A: 

colorbox is great. It relies on JQuery.

To use it with an html string, you would call it like this:

$.colorbox({html:'<p>Hello</p>'});
Lee
A: 

SLaks is correct. You should definitly use JQuery UI dialog. Here is an example of using the JQuery dialog as a modal, very similar to using lightbox.

$("#dialog-message").dialog({modal: true});
jhanifen