Question

I am trying to do kind of a wizard using thickbox, and it works fine when opening it the first time. When I click next I would like to close the div I have opened and open a new one in thickbox, but how is it done? I have tried the following code, but it just closes the thickbox and doesn't open it again:

tb_show("", "#TB_inline?height=280&width=620&inlineId=divStart", "");
tb_remove();
tb_show("", "#TB_inline?height=280&width=620&inlineId=divContinue", "");
Was it helpful?

Solution

You can use this code:

//dont use tb_remove() function

$("#TB_window").remove();
$("body").append("<div id='TB_window'></div>");
tb_show("", "#TB_inline?height=280&width=620&inlineId=divContinue", "");

If you use iframe for loading content:

var p = parent;
p.$("#TB_window").remove();
p.$("body").append("<div id='TB_window'></div>");
p.tb_show("", "#TB_inline?height=280&width=620&inlineId=divContinue", "");

OTHER TIPS

I came to this answer page, and tried the solution proposed here. It did not work. I used one of my old tricks, and like almost everytime, it worked. Although this post is more than 3 years old, I wanted to share the trick. The trick is to use window.setTimeout to delay the call to the next tb_show().

window.setTimeout(function(){
    tb_show("", "#TB_inline?height=300&width=300&inlineId=confirmDiv&modal=true");
    $("#TB_window").css({'border':'0px', 'background':'none'});
    },300); 

Please also note two other tricks I have used:

  1. I wanted to show a modal popup.The HTML was in a div with id "confirmDiv". But it was showing the usual thickbox with title and padding. So the second line removes the border and background color from TB_Window, which shows only the popup HTML.

  2. I also used a general height width of 300px, although my popup was only 250px. This will prevent the scrollbars even if the content is a little bigger. The TB_Window is not showing anyway, so it won't matter.

Hope this helps somebody.

I found the answer myself. I opened a div containing all the steps, and the just through javascript decided what div to show.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top