ThickBox, a Lightbox-like modal window framework for the browser written by Cody Lindley that runs on top of the jQuery library, has been given a bit of an upgrade. The new 2.0 release adds greybox functionality (iFramed content), image set support (similar to the Lightbox 2.0 functionality), and is now running on jQuery 1.0 among other things.
You might be asking yourself:
“Why wouldn’t I just use Lightbox 2.0 if ThickBox 2.0 does the same thing?”
Won’t someone please think of the
children end user?
Another advantage that ThickBox has over Lightbox is that images are automatically resized if the browser window is too small to display them full size without scrolling. Also, clicking outside of the modal window closes it in ThickBox, whereas in Lightbox, a “close” button must be clicked to remove it from the screen.
Visit the ThickBox demo site for instructions on installation, demos of different techniques (including iFramed content and AJAX content), and support information.
Currently supported and tested browsers include Internet Explorer 6 and 7, Firefox 1.5+ on both OS X and Windows, Opera 9+ and Safari 1.3.2 and 2.0.3., though it should work on any modern browser. ThickBox is protected by the MIT License.
Check out some of Myles other experiments with jQuery. For the jQuery beginner these are good examples to start out with. The treeview is another experiment that caught my eye.
Will used a lot of techniques to really simulate the 3d experience correctly:
- He adjusts the opacity and z-index of the images based upon the depth of the element.
- The height and width are also adjusted dynamically – but are all laid out using fontSize and EMs, allowing you to also simulate depth-of-field with text (in addition to static images or elements).
- The background moves based upon the speed, and direction, of rotation.
Also, take a look at his code for specific caching optimizations used (like saving a reference to a single jQuery object and calling it over and over, rather than re-querying on every rotation).
Be sure to digg this up as it’s a really great example of the power of jQuery.
Aptana is a IDE for developing Web 2.0 web sites quickly and easily. The key is to see what you are doing as you do it in the preview pane. Aptana requires JRE v1.4.2 and can be installed on Windows, Mac and Linux. It is also available as a Eclipse plugin with other IDEs to come.
- Errors and warnings across all 3 languages (code validation)
- Support for Mac (Universal Binary) and Windows with Linux coming soon
- Free and open source ” — Aptana FAQ
John Resig has been working with Aptana to improve the jQuery docs such that they’ll work better with their autocomplete api, so look for that in the near future.
If there’s anything that’s apparent from watching the jQuery mailing list and jQuery-related blog posts on Technorati, it’s that there’s a huge international audience for the library.
As I’ve been working on the new version of the web site (to be released together with the upcoming version 1.0 of jQuery) I’ve had a number of offers from users to translate documentation and blog posts into their native language. I cannot express how pleased I am by this.
I have two questions for all the jQuery users out there: If you are fluent in language other than English, would you be willing to help translate alternate versions of blog posts or documentation? If you are, please respond to this post so that I can get a feel for everyone who is interested and what languages are represented.
Secondly, if you speak a language other than English (but may, or may not, be able to help translate), please let me know what language you would like to see the jQuery site in:
Thank you, everyone, for your input – it’s greatly appreciated.
(by the way, the Internationalization module for Drupal is very cool)
jQuery provides an extremely versatile DOM query mechanism. If you’re wondering what’s happening under the covers, and if there are less- and more-performant ways to formulate your query . . . the answer is YES. In many cases you can help jQuery by specifying a tag name, i.e.:
is faster than:
. . . with the difference being that the query engine can narrow by tag name first. It’s smart like that.
So, you shoud be in the habit of specifying a tag name. The only exception: getting by ID. If you’re getting by ID, do not include a tag name, or anything else besides the ID selector.
Note that the second example here (with the class selector only) is perfectly valid, and if you need to query for multiple element types, by all means go ahead — jQuery will still return the correct results.
There is a lot of good plugin development going on for jQuery. Here are two which have come up on the list lately:
HighlightFade by Blair Mitchelmore is a very thorough jQuery implementation of the “yellow fade” technique. Options include the type of fade (linear, sinusoidal, exponential), the duration, and a function to call on completion. The plugin weighs in at 3.5K (uncompressed, so it could be made smaller), and should handle all your yellow-fading needs.
Tablesorter by Christian Bach is browser-side table sorter (click on a column heading to sort the table accordingly). It’s fast (in the demo, sorts 400 rows in about .3 seconds), and it auto-detects the column type to provide the appropriate kind of sorting. For example, it automatically recognizes date vs. text vs. URL contents, and sorts accordingly. For URLs, it disregards the http/https/ftp/file prefix for sorting purposes, which is more likely to give you the sort you actually want. You can also define your own auto-detects, which usually involves 5-10 lines of code. The plugin is about 10.5K uncompressed.
Did you know there are lots more jQuery plugins listed on the wiki at http://proj.jquery.com/plugins/? Note that the URL to the wiki will change when jQuery goes 1.0.
Steven Wittens of Drupal fame has released a nifty jQuery plugin of his own called Farbtastic. So what does it do, you ask?
Farbtastic uses layered transparent PNGs to render a saturation/luminance gradient inside of a hue circle. No Flash, no pixel sized divs.
Just include the farbtastic.js file along with the farbtastic.css stylesheet and create a placeholder
div along with a form element for the hex code like so:
<input type="text" ... />
And then include the one line jQuery code:
That’s all there is to it! You should now have a color picker widget on your page.
To see a working demo as well as more in depth instructions on using the plugin, visit the Farbtastic page. Farbtastic is protected by the GPL.
We’ve all heard of in-line editing. Flickr uses it for many things such as changing the title or description of one of your pictures.
For those of you who dont know, in-line editing is when you can just click on text, and it becomes a text box which the user can then edit. When the user hits enter, the edited text is sent to a script, which can do some magic, like submitting the text to a database.
Now, thanks to Dylan Verheul, doing this with jQuery could never be easier. He has created a plugin called Editable, which makes it possible to create in-line editing fields with one simple line of code.
The source code, along with a (
broken fixed) demo can be seen here. I have put together a simple working demo on my website, here.