Skip to content

Instantly share code, notes, and snippets.

@vanpariyar
Created January 7, 2020 05:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save vanpariyar/4b00ac2d7568f7593960c68e8d7f8c83 to your computer and use it in GitHub Desktop.
Save vanpariyar/4b00ac2d7568f7593960c68e8d7f8c83 to your computer and use it in GitHub Desktop.
Newsletter popup with session storage
if (typeof(Storage) !== "undefined") {
// Store
function showPopup(){
window.setTimeout(function () {
$('#newsletter-modal').modal('show');
sessionStorage.setItem("popup", 'hide');
},6000);
}
if( !sessionStorage.getItem("popup")){
sessionStorage.setItem("popup", 'show');
}
if( sessionStorage.getItem("popup") == 'show'){
showPopup();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment