Posted on by

Cody Lindley just released a brand new version of Lightbox/Greybox called Thickbox. This release offers some great, added, functionality over the other libraries. Specifically, this release is completely unobtrusive – it uses the natural href, src, and title attributes to seed the box, when it pops up. Even if you don’t have Javascript enabled, it still behaves naturally. It is also capable of dynamically loading blocks of html and displaying it in the overlay. In all, it’s a great release, not the least of which is the fact that it uses jQuery to pull it all together. So check it out, play with it, and let Cody know what you think of it!

20 thoughts on “Thickbox

  1. abba bryant on said:

    Using the ajax load function to pull parts of the document in is nice but (always a but somewhere) wouldn’t it be more accessible if the documents had doctypes and all the markup?

    Is it possible at this time to use jquery to return the full html of the document and then select just the stuff between the body ( or some other )tag for inserting in the case of ajax?

    It would just be awesome to see this script and jquery working together to do the correct accessible semantic web thing instead of a partially correct inaccesible web thing ( so last year )

  2. To Abba Bryant:

    One way to do this would be to use a dynamic language (PHP or Ruby) to generate the html for the Thickbox. Then you could have the script detect whether the request is ajax or just a normal get and return an html snippet or a whole valid xhtml document (respectively).

    In ruby on rails it’s as easy as adding something like this to your controller:

    if request.xhr?
    render ‘stuff’, :layout => :none
    render ‘stuff’

    I’m sure this can be done in PHP also.

  3. @abba – It’s possible to have a regular expression, using javascript remove or leave (no js) on these pages when they are loaded. I’m thinking about this for the next version?

  4. Scott_S on said:

    Has anyone had any problems with the Thickbox. We have it working and it does what we want – however- intermittently when a thumbnail is clicked we get the new image appear in a new browser window by itself with a white background- if we go back and pick the image again all works again no problem.

    It is not one specific image or page that is causing the problem.

  5. @Scott_S: This happens when you click a Thickbox link before the page has finished loading. If the javascript hasn’t added the onclick events to the links they fall back to just pulling out the original file.

    This happens with every unobtrusive link enhancement script: Lightbox, Greybox, etc.

    The only way around it is to make your page content interesting enough to hold the users attention for a few more seconds before they feel like clicking something. :)

  6. For your provided example page, it seems that a strange display bug is created in Firefox ( if you swap out the jQuery file with the compressed version of jQuery. Clicking on one of the two thumbnails causes a flash/refresh on the right side of the screen. Any ideas what the difference between teh two .js files might be causing?

  7. @Scott S.: I experience the same thing using Firefox/Win each time a page is loaded fresh for the first time (or cache is cleared), regardless of how much time I wait after page load. Clicking back, it works from then on (until I clear cache & refresh again).


  9. Chris Hansen on said:

    I’m trying to call thickbox from within a div. The content of that div is dynamically loaded using the jQuery’s load function.

    It fails.

    The thickbox is created perfectly if I call it from outside the div, but called from the dynamically loaded content inside the div, it acts just like any other link and redirects to the desired page.

    Does someone have a solution to this issue? How do I call a thickbox from within a dynamically loaded div?

  10. Pingback: LỊCH SỬ HÌNH THÀNH VÀ PHÁT TRIỂN CỦA JQUERY - Thiết kế website chuyên nghiệp !!

  11. Хорошо! Надеюсь продолжение будет не менее интересным…