I am using the stopwatch plugin and I want to be able to save the stopwatch value to a cookie but I don’t know how to do this? Basically I want a popup to appear after 2 minutes on my website regardless if they are looking at different pages of the website or not so the cookie starts counting as soon as the user goes on the website and they may be on the home page then go to about us page but the stopwatch cookie is counting up to 2 minutes in the background, I currently have this:
var timer = $('#test').stopwatch().stopwatch('start');
// I need this to go in to the cookie below...
$.cookie('popuptimer', 'timer', { expires: null });
if($.cookie('popuptimer') == 1000*60*2){
$.fancybox({
overlayOpacity: 0.8,
overlayColor: '#000',
type: 'iframe',
width: 625,
height: 550,
overflow: 'auto',
padding: 0,
href: '<?php echo base_url(); ?>feedback'
});
}
I don’t understand exactly what you want to do but to save a value with
$.cookieyou should doThen you can retrieve it like you do
of course this assumes that timer is a number / string and not an object