Tip for opening jQuery thickbox programmatically

by Jack K

jQuery Thickbox has been around for a while and we've used it in a bunch of projects and every time I decide I want to open a thickbox programmatically, instead of via the usual binding method, I have to fish for how to do it. The last time I went fishing, I found this and decided to post about it, thinking, "hey, if I post about it, I might actually remember where to find it next time I go fishing". OK, yeah, I'll probably still have to google for it, but anyway, here's the link:

http://blog.gridworlds.com/js/working-with-thickbox

Look down the page for "Calling Thickbox via JavaScript". Bingo.

3 comments

Comment from: pgpatrudu [Visitor]
The trick posted here did not work for me.
It is greying the whole screen in IE 6.0; when I try it programatically; It works perfectly when I click it manually.

Please let me know if there is anything more to this .....

Regards & Thanks
P G Patrudu
India.
08/19/09 @ 06:57
Comment from: Alexsandro Pimenta [Visitor] · http://blog.alexpimenta.com
Hi P G Patrudu,

Try to use like following javascript code:

$(document).ready(function(){
var url='***yourpage***?KeepThis=true&TB_iframe=true&width=700&height=500';
tb_show('PressRelease Preview', '{0}');
});

bregards,
Alex Pimenta
Brazil
08/31/09 @ 12:54
Comment from: Resume Writing Service [Visitor] · http://www.resume-service.biz
I completely agree with the above comment, the internet is with a doubt growing into the most important medium of communication across the globe and its due to sites like this that ideas are spreading so quickly.
07/29/10 @ 22:46

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)