I am using a popup when visitors get to a certain section of the site. When a visitor hits the x the popup closes, and I want this state to persist throughout their visit so they don't get annoyed. But if they close their browser and come back to the site another day, I would like the popup to show again.
In Chrome desktop browser: Right now, it is working where the popup shows, if I click the x it closes and if I click deeper into other pages on the site, it doesn't show again, but if I go back to the top-level page it pops up again. And vice versa, if I enter on an interior page and hit close it works, but if I get to the top level page it shows again. What am I doing wrong?
require(["jquery", "domReady!"], function ($) {
// mobile
$(window).on('touchmove', function () {
if (($(window).scrollTop() > $(window).height() / 2) &&
sessionStorage.getItem('semCroPopupDisabled') !== "true" ) {
$('#croWrapper').animate({
bottom: 0
}, 'fast');
}
});
// desktop
$(window).on('scroll', function () {
if (($(window).scrollTop() > $(window).height() / 2) &&
sessionStorage.getItem('semCroPopupDisabled') !== "true" ) {
$('#croWrapper').animate({
bottom: 0
}, 'fast');
}
});
$('#croWrapper').on('click', '#xclose', function () {
sessionStorage.setItem('semCroPopupDisabled', "true");
$('#croWrapper').hide();
});
});