JQuery: Telling Thickbox Script to run after x seconds?

Garrett

music LOUD
Feb 4, 2008
3,847
131
0
I am currently running lots of PPC traffic in one of the more expensive markets out there, and I figure I should test out those Modal boxes for capturing leads.

Since "on-exit" is a bit too obtrusive... I'd like to just pop the Modal box after 30 seconds or so. That way I can catch people who are actually evaluating the offer.

I really like the JQuery Thickbox script and think it would do very nicely since you can embed HTML into the modal window. Of course I'd pop a form.

Does anybody know how to go about modifying it to do its thing after say... 30 seconds?

Thx.
 


Got it working. I rock! (jk).

I'll post the code so maybe someone else can use it. The script is popping ( pop.php ) after 30 seconds.

On your lander in the head section, reference jquery, thickbox.js, and thickbox.css

Code:
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="stylesheet" type="text/css" href="thickbox.css" />
<script src="http://jqueryjs.googlecode.com/files/jquery-1.3.2.js" type="text/javascript"></script>
<script src="thickbox.js" type="text/javascript"></script>
paste this code directly beneath the code above (still in <head> tag)

Code:
<script>
$(document).ready(function(){
setTimeout(function () { 
tb_show("CD ROM Order","pop.php?height=120&width=400","images/cart.jpg");
    
}, 30000);
});
</script>

Now change your body tag to this...

Code:
<body onload="tb_show()">

Shapow! Been had delayed Thickbox popups!
 
Ok... quick fix. The reason it wasn't working is because onload it was loading a dark background with 75% opacity or whatever. It wasnt waiting 30 seconds to load this part. So I just changed that image to a clear .png - Now I dont get the dark background when the window pops anymore, but whatever.