0

I really need to know how to put a cookie on my fancybox so the visitors see the fancybox on the first visit and then the cookie prevent the fancybox to be onload for 3 days, this is my code so far and the fancybox works but I don't know how to set up the cookie:

$(document).ready(function(){
      $("#hidden_link").fancybox().trigger('click');
});
Michael Robinson
  • 29,278
  • 12
  • 104
  • 130
Javier
  • 1

1 Answers1

1

You should just use server side - php or whatever your preference is.

<script type="text/javascript">    
<?php
         if(!isset($_SESSION['hideFancybox'])){
            echo '$.fancybox({href:"#hidden_link"});';
         }else{
            $_SESSION['hideFancybox'] = 1;
         }
?>
</script>

Or something to that effect.

DropTheNerd
  • 134
  • 3