Set a jquery cookie on my fancybox onpage load -


this used load fancybox on page load. however, want appeared on new visitors or people visited page 3 days ago.

i guess jquery cookie don't know how.

jquery(document).ready(function() {     $.fancybox(         '<h2>hi!</h2><p>lorem ipsum dolor</p>',         {                 'autodimensions'    : false,             'width'                 : 350,             'height'                : 'auto',             'transitionin'      : 'none',             'transitionout'     : 'none'         }     ); }); 

in <head> add <script src="jquery.cookie.js"></script>, then:

$(function() {     if ($.cookie('mycookie')) {         // hasn't been 3 days yet     } else {         $.fancybox(             '<h2>hi!</h2><p>lorem ipsum dolor</p>',             {                 'autodimensions'    : false,                 'width'             : 350,                 'height'            : 'auto',                 'transitionin'      : 'none',                 'transitionout'     : 'none'             }         );     } });  // set cookie expire in 3 days $.cookie('mycookie', 'true', { expires: 3}); 

this uses cookie plugin.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -