Jonathan
Jonathan

Reputation: 32888

Javascript lightbox component that works with arbitrary HTML

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?

Upvotes: 0

Views: 262

Answers (3)

jhanifen
jhanifen

Reputation: 4591

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

Upvotes: 1

Lee
Lee

Reputation: 13542

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

Upvotes: 1

SLaks
SLaks

Reputation: 887937

You can use jqModal or jQuery UI dialog.

Upvotes: 1

Related Questions