AJAX imported content is not initialized by ThickBox. ThickBox initializes its content (elements with the thickbox class) on page load. The imported AJAX content is not there yet.
And, AJAX doesn't run scripts on (from) imported pages, at least not most scripts.
So, we can take a page from Lightbox v2.04's book, which initializes the document to check for click events, instead of the individual lightbox elements.
Note: This solution worked out and tested with ThickBox 3.1 and jQuery 1.2.6, results may vary with other versions of ThickBox or jQuery.
How this works out is, first install ThickBox (jquery.js, thickbox.js, and thickbox.css) in the head of your 'top' page, the one with ajaxtabs on it, just as if it were to be the only page with any ThickBox content on it (configuring the resource images to work with that page). After that in the head of your 'top' page, put this script:
Code:
<script type="text/javascript">
function tb_init(){
$(document).click(function(e){
e = e || window.event;
var el = e.target || e.scrElement || null;
if(el && el.parentNode && !el.className || !/thickbox/.test(el.className))
el = el.parentNode;
if(!el || !el.className || !/thickbox/.test(el.className))
return;
var t = el.title || el.name || null;
var a = el.href || el.alt;
var g = el.rel || false;
tb_show(t,a,g);
el.blur();
return false;
});
};
</script>
That will replace ThickBox's native initialization with one that listens for clicks on the page, but that otherwise does the same thing. Now your imported content will work with Thickbox.
Bookmarks