我有 4-5 个 HTML 页面,我只想显示一次弹出窗口,这意味着弹出窗口应该显示在每个页面中。它工作正常。
但是我希望,当使用关闭图标隐藏模式时,它永远不会在关闭窗口选项卡之前显示。
$(function () {
if (localStorage.getItem('popState') != 'shown') {
$("#popup").fadeIn();
localStorage.setItem('popState', 'shown');
}
$('#popup-close').click(function (e) {
$('#popup').fadeOut();
localStorage.setItem('popState', 'shown');
});
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="footer-alert" id="popup" style="display:none;">
<div class="footer-alert-close" id="popup-close">X</div>
<p>We use cookies to make interactions with our websites and services easier and more meaningful, including learning to understand how they are used. You can read more about our <a href="privacy.html"><b>Privacy & Cookies Policy here</b></a>. By continuing
to use this site you are giving us your consent to our policy.</p>
</div>