I have 5 pages and I am including a banner in the 1st page, if the user closes the banner in 1st page then the banner should not appear in the other pages too.
$(document).ready(function(){
$(".alert-banner-hide").on("click", function(){
$("#alert-banner-container").hide();
});
});
Could you please help me on this? Thanks in advance.
Use sessionStorage
Object to have something stateful :
$(".alert-banner-hide").on("click", function(){
$("#alert-banner-container").hide();
sessionStorage.setItem("banner-closed","yes"); //add this instruction
});
And
// Copy/Paste the whole code below & don't worry
$(function(){
if (sessionStorage.getItem('banner-closed')==="yes"){
//trigger close banner
$("#alert-banner-container").hide();
}
})