Home › Forums › JavaScript › Opening a thickbox via onclick? › Re: Opening a thickbox via onclick?
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:
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.
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:
$(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
$(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.