Skip to content

Instantly share code, notes, and snippets.

@fourroses666
Created April 9, 2015 10:39
Show Gist options
  • Save fourroses666/243d04e351b26465e886 to your computer and use it in GitHub Desktop.
Save fourroses666/243d04e351b26465e886 to your computer and use it in GitHub Desktop.
popup js
cookie_popup = (function() {
var date = new Date();
var minutes = 5;
date.setTime(date.getTime() + (minutes * 60 * 1000));
if ($.cookie('cookie_popup') == undefined) {
$('.cookie-popup-wrap').fadeIn(600);
$.cookie('cookie_popup',true,{ expires: date });
};
$('#closepopup').click(function (e) {
e.preventDefault();
$('.cookie-popup-wrap').fadeOut(600);
});
});
setTimeout(function() {
cookie_popup();
}, 2000);
$(window).scroll(function(){
if($(this).scrollTop() > 100){
cookie_popup();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment