...

View Full Version : Fancybox popup on page load



lifeisboost
08-19-2011, 05:08 PM
I have a page that loads a fancybox popup and it works perfectly with the cookie for setting ho many days to show. the problem i have is that i need it to show 1 every 24 hours over a 3 day period. once the 3rd day is over and the user sees the window for the 3rd day i need a cookie set to never show the window again. here is my code as it sits now. I have worked with this for a couple of days on and off and it is above my head for sure.

any help is appreciated.

$(function() {
if ($.cookie('moment_comm')) {
// it hasn't been 1 day yet
} else {


$("#autostart").fancybox({'overlayShow':true,frameWidth:
840,frameHeight:360}).trigger('click');
}
}
);

$('#autostart').live('click', function(e) {
e.preventDefault();
$.cookie("moment_comm", "true", { path: '/', expires: 1 });

$.fancybox.close()
});

lifeisboost
09-08-2011, 06:40 PM
revisiting this here i have come up with this which is some what of what i am looking for.

$(function() {
if ($.cookie('moment_comm')) {
$("#autostart").fancybox({'overlayShow':true,frameWidth:
840,frameHeight:360}).trigger('click');
}
}
);

$('#autostart').live('click', function(e) {
e.preventDefault();
$.cookie("moment_comm1", "true", { path: '/', expires: 365 });

$.fancybox.close()
});

} else if ($.cookie('moment_comm1')) {
$("#autostart").fancybox({'overlayShow':true,frameWidth:
840,frameHeight:360}).trigger('click');
}
}
);

$('#autostart').live('click', function(e) {
e.preventDefault();
$.cookie("moment_comm2", "true", { path: '/', expires: 365 });

$.fancybox.close()
});
} else if ($.cookie('moment_comm2')) {

} else {


$("#autostart").fancybox({'overlayShow':true,frameWidth:
840,frameHeight:360}).trigger('click');
}
}
);

$('#autostart').live('click', function(e) {
e.preventDefault();
$.cookie("moment_comm", "true", { path: '/', expires: 365 });

$.fancybox.close()
});




but i get a syntax error at

} else if ($.cookie('moment_comm1')) {



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum