Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Opening a thickbox via onclick? Re: Opening a thickbox via onclick?

#61798
flashaddik
Member

Sorry to dig up an old thread.. however I think I found a solution for making a table cell work with thickbox.

In your thickbox.js file…

Find:

Code:
$(document).ready(function(){
tb_init(‘a.thickbox, area.thickbox, input.thickbox’);//pass where to apply thickbox
imgLoader = new Image();// preload image
imgLoader.src = tb_pathToImage;
});

and add td.thickbox to the tb_init parameters.

Code:
$(document).ready(function(){
tb_init(‘a.thickbox, area.thickbox, input.thickbox, td.thickbox’);//pass where to apply thickbox
imgLoader = new Image();// preload image
imgLoader.src = tb_pathToImage;
});

Find:

Code:
function tb_init(domChunk){

$(domChunk).click(function(){
var t = this.title || this.name || null;
var a = this.href || this.alt;
var g = this.rel || false;
tb_show(t,a,g);
this.blur();
return false;
});

}

and add ‘|| this.abbr’ to the variable a

Code:
function tb_init(domChunk){

$(domChunk).click(function(){
var t = this.title || this.name || null;
var a = this.href || this.alt || this.abbr;
var g = this.rel || false;
tb_show(t,a,g);
this.blur();
return false;
});

}

then simply place the class="thickbox" and abbr="yourlinkhere.html" to the table cell.

Maybe someone out there can find a hole/flaw in this but it seems to work fine for me. I haven’t tested in on older browsers such as IE6.