Question

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?

Was it helpful?

Solution

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>'});

OTHER TIPS

You can use jqModal or jQuery UI dialog.

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});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top