How to make ThickBox only show up the first time on your web site with cookie control.
As stated in my previous post I have been diligently working on this LightBox / ThickBox implementation for a client. Banging my head against the keyboard for several days. But its working now.
Here is what you need if you want your Box (LightBox / ThickBox / what ever implementation..)to only show up the first time someone hits your site.
First you will need a file off of plugins.jquery.com just right click the link and save as:
jquery.cookie.js
http://plugins.jquery.com/files/jquery.cookie.js.txt
Place this file in you public directory my folder name is /js
Just make sure you remember where it is at. because you will need to referance that later in your site code.
then here is my example
Place this line of code in the <head> of you site
<script type="text/javascript" src="js/jquery.cookie.js"></script>
After <body> somewhere here is the implementation for the pop-up with cookie control
<script type="text/javascript">
$(document).ready(function(){
if ($.cookie('guest') != '1') {
tb_show("Coupon","***WHATEVERYOUR PAGE***.html?height=490&width=380");
$.cookie('guest', '1', { expires: 2 });
}
});
</script>
Where as the 'guest' is just the name of the cookie (I guess.. lol)
!='1' is the limitation on how many times it will show up.
{ expires: 2 } is the days it will take before it shows up again on that persons computer.
Hope this helps someone out there ...
As stated in my previous post I have been diligently working on this LightBox / ThickBox implementation for a client. Banging my head against the keyboard for several days. But its working now.
Here is what you need if you want your Box (LightBox / ThickBox / what ever implementation..)to only show up the first time someone hits your site.
First you will need a file off of plugins.jquery.com just right click the link and save as:
jquery.cookie.js
http://plugins.jquery.com/files/jquery.cookie.js.txt
Place this file in you public directory my folder name is /js
Just make sure you remember where it is at. because you will need to referance that later in your site code.
then here is my example
Place this line of code in the <head> of you site
<script type="text/javascript" src="js/jquery.cookie.js"></script>
After <body> somewhere here is the implementation for the pop-up with cookie control
<script type="text/javascript">
$(document).ready(function(){
if ($.cookie('guest') != '1') {
tb_show("Coupon","***WHATEVERYOUR PAGE***.html?height=490&width=380");
$.cookie('guest', '1', { expires: 2 });
}
});
</script>
Where as the 'guest' is just the name of the cookie (I guess.. lol)
!='1' is the limitation on how many times it will show up.
{ expires: 2 } is the days it will take before it shows up again on that persons computer.
Hope this helps someone out there ...