Skip to content

Instantly share code, notes, and snippets.

@sokoljr
Created November 1, 2016 08:35
Show Gist options
  • Save sokoljr/15e75f7c906c849f068a0653dd35eba9 to your computer and use it in GitHub Desktop.
Save sokoljr/15e75f7c906c849f068a0653dd35eba9 to your computer and use it in GitHub Desktop.
Modal window whith cookie
$(window).load(function() {
var hideTheModal = $.cookie('hideTheModal');
if(hideTheModal == null) {
$('#overlay').fadeIn(400,function() {
$('#modal_form').css('display', 'block').animate({opacity: 1, top: '50%'}, 200);
});
$('#modal_close, #modal_success').click( function() {
var date = new Date();
var minutes = 1;
date.setTime(date.getTime() + (minutes * 60 * 1000));
$.cookie('hideTheModal', 'true', { expires: date });
$('#modal_form').animate({opacity: 0, top: '45%'}, 200, function() {
$(this).css('display', 'none');
$('#overlay').fadeOut(400);
});
});
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment