A
A
Alexander2015-10-30 07:56:14
JavaScript
Alexander, 2015-10-30 07:56:14

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

3 answer(s)
D
Denis Bukreev, 2015-10-30
@denisbookreev

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

A
Andrew, 2015-10-30
@R0dger

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

V
Vitaly Inchin ☢, 2015-10-30
@In4in

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){
   //Что-то делаем
}
......

A rougher version with a 5-minute check
var timeGap = false;
setTimeout(function(){ timeGap = true; }, 3e5);

......
if(timeGap){ ... }
......

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question