Answer the question
In order to leave comments, you need to log in
How to implement two pop-up banners so that they pop up once per session (at 12 o'clock) in turn?
The site has a popup banner that is displayed every 12 hours
const banner = $('.popup-banner');
let bannerName = banner.attr('cookie-data');
if (!$.cookie(bannerName)) {
setTimeout(function() {
$(".popup-shadow").fadeIn(200);
banner.addClass('popup-opened');
banner.fadeIn(300);
}, 5000);
}
$(".popup-banner a").click(function() {
let cookieName = $(this).parents('.popup-banner').attr('cookie-data');
var date = new Date ();
var hours = 12;
date.setTime(date.getTime() + (hours * 60 * 60 * 1000));
$.cookie(cookieName, true, {
expires: date,
path: '/'
});
});
but you need to make two such banners so that they are displayed either once every 12 hours or once per session in a checkerboard pattern (in turn), i.e. first session banner 1 second banner 2 third banner 1 etc. ? With what can this be done?
Answer the question
In order to leave comments, you need to log in
once per session
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question