Answer the question
In order to leave comments, you need to log in
How to make such a popup window?
It is necessary that the pop-up window on fancybox works under 2 conditions:
1. The visitor came to the site for the first time
2. The visitor spent less than 5 minutes on the site,
how can I do this?
Answer the question
In order to leave comments, you need to log in
It should be borne in mind that pop-up windows themselves are terribly annoying to visitors.
If a window pops up on any site once, I'm already tense and want to quickly finish my business on this resource, and if the second time, then I will most likely close the site
1. Set the cookie and catch, if not, then the window
2. It's not very clear I spent one second or 2 minutes ... and then dig in the direction of settimeout or setinterval
var conditions = {
firstCame : !( localStorage.getItem('firstCame') || localStorage.setItem("firstCame", true) );
timeGap : Date.now() + 3e5; //3e5 = 300000 = 1000 * 60 * 5, т.е 5 минут
}
......
if(conditions.firstCame && Date.now() >= conditions.timeGap){
//Что-то делаем
}
......
var timeGap = false;
setTimeout(function(){ timeGap = true; }, 3e5);
......
if(timeGap){ ... }
......
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question