1

My site uses thickbox and as of now the only way to call it is by clicking on a link. Is there anyway to make a javascript function that calls a thickbox window?

Thickbox website: http://jquery.com/demo/thickbox/

I am aware that thickbox is jquery, but im not really sure how jquery functions are different from javascript functions because I belive jquery is javascript?

1
  • Thickbox is no longer unmaintained. You should consider switching to one of the alternatives listed at the top of the Thickbox page. Commented Jun 25, 2011 at 22:27

1 Answer 1

2

If you want to open a link/image that is bound to thickbox, just call

$('#my-link').click();

For all other cases, call the tb_show function

tb_show('Custom title', 'http://jquery.com/demo/thickbox/images/single.jpg')

You can also pass a third argument that will find all pictures from a group

tb_show('Custom title', 'http://jquery.com/demo/thickbox/images/plant1.jpg', 'gallery-plants')
Sign up to request clarification or add additional context in comments.

4 Comments

what do you mean by '#my-link'. sorry im a noob
#my-link is a selector that finds an element with an id="my-link".
@jared where can i put this link? in my index.php or the thickbox.js file?
With the first part of my answer I meant, that you already have an existing link on your page (e.g. index.php) that is there when thickbox initializes, that has attributes that thickbox is looking for, so after clicking on the link, the thickbox overlays shows up. In jQuery, you can call $(selector).click() to trigger all click event handlers bound to that element. Since thickbox registers click events, the overlay will open.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.