PHPology is a collective of highly skilled, award winning, web gurus.

Thickbox from content loaded via AJAX using jquery

Working on a project called Can You Draw The Internet? I was hit with a problem with my thickbox modal when content was loaded via AJAX. The thickbox modal would appear twice as the function TB_init() would be initiated twice. 

Searching the net, VinayRas came up with a solution that did the trick, the function highlighted below:

If you call TB_init twice over the same content, you can end up transforming your thickbox links twice. 

To avoid this, I modified TB_init like so:

function TB_init()
   var t = this.title || || null;
   var g = this.rel || false;
   $('a.thickbox').removeClass('thickbox'); // I added this line…
    return false;