views:

307

answers:

3

There is a huge number of jQuery modal box plugins out there. Jitter lists 20 of them in this response (http://stackoverflow.com/questions/1656086/modal-windows-plugin-to-rails#1656105).

Which one do you use and why? If you use different ones in different cases, how can they be broken down categorically by use-case?

+2  A: 

I pick what I want based on its primary use. The fact that you can use a lightbox variant to show a dialog box, doesn't make it a good candidate in my mind.

Generally if I need to show photos or another iframed web page, I use a lightbox variant. Two that we have used at our studio and been happy with are:

  1. Slimbox 2 (Just photos)
  2. Colorbox (Pretty much any type of content)

For dialog type behavior, I highly recommend using jQuery UI's dialog. It is in active development, and is super customizable.

[rant] Whatever you do please don't use SimpleModal unless you need its special type of callbacks. Otherwise, when you try to hook into an onClose callback, you'll find yourself having to perform the actual closing of the box. Just my two cents on that one. :) I just know it has come up a few times here in SO, and it just feels awkward to use IMO [/rant]

Doug Neiner
Great analysis. Thanks! What about forms? Does that fall under iframed website or a dialog box in your mind? For example a form that closes the model box and modifies the original page when it is submitted?
Allan Grant
No need to use an iframe for a form. Use jQuery UI Dialog. Its callbacks give you time to validate the form before really closing the box, etc. Check out their demo here: http://jqueryui.com/demos/dialog/#modal-form
Doug Neiner
LOL, just released I didn't actually answer your question. Since it is form I would consider that a good candidate for a Dialog.
Doug Neiner
You answered it perfectly! Thanks. I'm moving forward to jQuery UI Dialog for my present need.
Allan Grant
Thanks about the ColorBox. It is really awesome plugin for jQuery.
Braveyard
A: 

JQuery UI Dialog with a "plugin" to support iframes: http://elijahmanor.com/post/jQuery-UI-Dialog-w-Resizable-iFrame.aspx

I use it because it's included in JQueryUI and uses the jquery ui theme you use, which makes for a consistent UI with little cost

AlfaTeK
+2  A: 

I use Colorbox, it is because it is recommended alternative in non-maintained thickbox.

Basically it allows iframe, so image, flash etc are all okay. Also it is incentive for me to upgrade jQuery to 1.3.2 :-)

Tommy
I guess I can check the documentation for this, but perhaps you know the quick answer from experience: do I have to use an iFrame? What about just generating the content straight from javascript? Forms?
Allan Grant
You can use any type of HTML content with Colorbox, no iframe needed.
Doug Neiner
yes, you don't need iframe to display the box content, it is just a feature. btw, i use YAGNI approach. First capture what i need, then surf and find a lightbox that i don't need/change minimum of code to fit my need.
Tommy
Good point, regarding YAGNI. :)
Allan Grant
Thanks for recommendation. I think ColorBox will be mine new favorite jQuery Plugin. It looks really nice and small. +1 is coming here for this answer.
Braveyard
One more thing to mention is that since i pick jQuery. I won't pick a lightbox that need another js framework such as mootools/sciptaculous/prototype etc. So, the first thing i must do is deciding which JS framework i should use carefully when i start a project. Colorbox is small (9KB) and it is MIT(personally MIT is my favorite)
Tommy