so, im doing a new site for a friend and had to implement a new web 2.0 style (woo hoo yeah woo) lightbox effect. well, after toying around with mooFX, scriptaculous and jquery (by itself), i got really really frustrated. the code seemed to be bloated (as ive read now), the visuals were kinda klunky, and it just was more than i needed... thankfully, the dude who wrote this, thinned things out, and it works like a charm...
so, here we have THICKBOX - a great tool built on jQuery that needs, jquery's latest build, the thickbox.css file, and the thickbox.js file to include. literally, its as simple as this... for the javascript files
<script type="text/javascript" src="path-to-file/jquery.js"></script>
<script type="text/javascript" src="path-to-file/thickbox.js"></script>
and like this... for the .css file
<link rel="stylesheet" href="path-to-file/thickbox.css" type="text/css" media="screen" />
and then for the ajax part of it, and to actually make it work, use this
Description:
Use a hidden HTTP request (AJAX) to fetch files from the same server and have ThickBox display the contents of the files.
Instructions:
* Create a link element (<a href>)
* Give the link a class attribute with a value of thickbox (class="thickbox")
* Provide a path in the href to the file/directory on the server. (href="ajaxLogin.htm")
* In the href attribute, after the URL path to the file, add the following query on to the end of the URL:
?height=300&width=300
* Change the values of height and width in the query accordingly
* Optionally you may add modal=true to the query string (e.g. ?height=300&width=300&modal=true) so that closing a ThickBox will require calling the tb_remove() function from within the ThickBox. See the login example, where you must click cancel to close the ThickBox.
and in the tag you want to use to activate the lightbox, simply use this:
<a href="_updateProfile_form.html?height=400&width=680" style="font-size:11px;" class="thickbox">Update your profile</a>
where the .html file i have could be any file you want to pull into the div that becomes your lightbox! its that easy!!!
im a designer/developer hybrid, not quite a javascript expert, and more of a designer than a developer, except when it comes to ColdFusion, whereby, EVERYONE can be a developer :) hahha, ok, anyway, the implementation is soo darn simple, i can only say, that thanks to jake at rainn for showing me about thickbox, and dan vega who last night told me about jQuery, not only am i implementing thickbox, but im populating the thickbox window with another external html file, using AJAX!
hah! so, me, a lowly designer is using all these cool things, and it couldnt have been any easier to implement.
head on over to the thickbox implementation page, and check it out...
ps. here is my little piece that im doing click on "Update Your Profile" on the left side, just a bit down the page...
(the site isnt done yet, its going to be a cool site overall, and the cause is awesome, so, if when im done the site, you feel like donating to RAINN, go here, and do so. thanks!)