Search code examples
javascriptlightboxpopupwindowlightwindow

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?


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