Skip to content

Instantly share code, notes, and snippets.

@richgcook
Created February 4, 2016 16:09
Show Gist options
  • Save richgcook/1c6112bc048c73c3e91d to your computer and use it in GitHub Desktop.
Save richgcook/1c6112bc048c73c3e91d to your computer and use it in GitHub Desktop.
Cookie with modal
function overlays() {
if (!Cookies.get('mailing_list')) {
$('.mailing-list-popup').show();
} else {
$('.mailing-list-popup').hide();
}
$('.mailing-list-popup .close').on('click touchstart', function(e) {
Cookies.set('mailing_list', '1', { expires: 7 });
$('.mailing-list-popup').fadeOut(250, function() {
$('.mailing-list-popup').removeAttr('style');
});
e.preventDefault();
});
}
overlays();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment