Answer the question
In order to leave comments, you need to log in
How to show a window to a person only once?
Good afternoon!
There is a popup window, I need it to be displayed only in the mobile version and only once.
How can I make it so that if the person closes the window, it won't show again until they close the browser?
Tell me, do you need cookies?
$(document).ready(function() {
if ($(window).width() < 768 ) {
$('#mobile').show();
$('#mobile span').click(function() {
$('#mobile').hide();
});
}
});
Answer the question
In order to leave comments, you need to log in
$(document).ready(function() {
if ($(window).width() < 768) {
if (localStorage.getItem("modal") != "off") {
$("#mobile").show();
}
$("#mobile span").click(function() {
$("#mobile").hide();
localStorage.setItem("modal", "off");
});
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question