Thickbox Cookie Question (SOLVED)

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
cupaball
Forum Commoner
Posts: 85
Joined: Sun Feb 12, 2006 1:46 pm

Thickbox Cookie Question (SOLVED)

Post by cupaball »

Any idea on how to trigger a thick box once a page is loaded? But also set a cookie so it happens once?
Last edited by cupaball on Wed Jan 28, 2009 11:01 am, edited 2 times in total.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Thickbox Question

Post by pickle »

There are tons of different Thickbox scripts out there - most with pretty good documentation on how to invoke them. Google it.
There is also some Javascript out there that allows you to access cookies. Google it too.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
cupaball
Forum Commoner
Posts: 85
Joined: Sun Feb 12, 2006 1:46 pm

Re: Thickbox Question

Post by cupaball »

Uh...okay.

Can someone point me in the right direction?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: Thickbox Question

Post by pickle »

Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
cupaball
Forum Commoner
Posts: 85
Joined: Sun Feb 12, 2006 1:46 pm

Re: Thickbox Question

Post by cupaball »

Thanks for all the help...

For those of you looking for the code, here it is. Make sure you have you the jquery, thickbox, and jquery cookie code referenced in your code and this will do it..

This code will show a thickbox once by setting a cookie for 6 days. You can change "thickbox-page-cookie", "iwashere", "expires: 6" and "http://www.google.com?keepThis=true&TB_ ... &width=900".

Code: Select all

 
<script type="text/javascript">
 
$(function() {
    var COOKIE_NAME = 'thickbox-page-cookie';
    $go = $.cookie(COOKIE_NAME);
    if ($go == null) {
        $.cookie(COOKIE_NAME, 'iwashere', { path: '/', expires: 6 });
        tb_show('', 'http://www.google.com?keepThis=true&TB_iframe=true&height=373&width=900', null);
    }
    else {
    }
});
 
</script>
 
Post Reply