Sometimes we want to open a Thickbox in a different fashion than a anchor-class-title combination. For example:
- When the thickbox needs to be open concerning some logic.
- When you want to open a thickbox immediately after your web document is loaded.
- Any other case in which you need to have more control.
This function is defined inside the thickbox.js file (or thickbox-compressed.js).
This is an example:
This is just the title you want to appear in the top of the thickbox (as long the thickbox is not modal).
This is the URL you want to be loaded inside the thickbox.
Just in case, lets explain that a little more:
- options/clients.aspx: This is the URL, nothing strange here, right?
- KeepThis=true: This is just a variable we want to pass to the page using the GET protocol (QueryString).
- It is not necesary that you use KeepThis var in al your thickbox calls. I mean, this is perfectly valid:
- TB_iframe=true&height=430&width=600: This string is used by the thickbox to know the dimensions it should be. And also, if the thickbox is going to be inline or not. Also you can define if the thickbox is modal or not like this so:
Some thing you’ve maybe noticed is that there´s not an & between the TB_iframe and the KeepThis=true strings.
This is not really necessary because the thickbox splits this string and TB_Iframe and rest of the strings after that is not passed to the URL via GET protocol. (Yes, you wil not have any var “width” or “height” defined in the destination page).
If you add an & like this anything bad is going to happen though :
But for your understanding, you are actually defining a new GET variable, an empty one.
Things you don’t want to do while using tb_show
Do not write any GET (query string) variable after the TB_iframe or TB_inline.
If you do this:
That variable MyVar will be ignored. Since all the Query String after TB_iframe will be cropped.
Be careful using character, like “, or ´ inside the title string, since this will brake the JS code.
This may be trivial, but for example, if you are using thickbox inside a GridView Item Template, and you use something like:
If the articleName have “ or ‘, this will brake the thickbox JS code.
Escape the characters, or replace them.