Подключаем Magnific Popup по стандарту и для открытия модального окна на определенную страницу добавляем HTML
HTML
<div id="PORRA" class="white-popup mfp-hide open">
Popup content
</div>
и в футер JS
JS
jQuery(window).load(function(){
setTimeout(function(){
jQuery.magnificPopup.open({
items: {src: '#PORRA'},type: 'inline'
});
}, 5000);
});
Так же можно использовать куки для того чтоб всплывающее окно отображалось только 1 раз
<script>
jQuery(window).load(function(){
var now, lastDatePopupShowed;
now = new Date();
if (localStorage.getItem('lastDatePopupShowed') !== null) {
lastDatePopupShowed = new Date(parseInt(localStorage.getItem('lastDatePopupShowed')));
}
if (((now - lastDatePopupShowed) >= (15 * 86400000)) || !lastDatePopupShowed) {
jQuery.magnificPopup.open({
items: { src: '#PORRA' },
type: 'inline'
}, 0);
localStorage.setItem('lastDatePopupShowed', now);
}
});
</script>
А если нужно сделать чтоб окно показывалось 1 раз и при этом запоминало посетителя то
$(window).on('load', function() {
var now, lastDatePopupShowed;
now = new Date();
if (localStorage.getItem('lastDatePopupShowed') !== null) {
lastDatePopupShowed = new Date(parseInt(localStorage.getItem('lastDatePopupShowed')));
}
if (((now - lastDatePopupShowed) >= (1 * 1)) || !lastDatePopupShowed) {
setTimeout(function(){
$.magnificPopup.open({
items: { src: '#PORRA' },
type: 'inline'
});
}, 2000);
}
});
И не забываем очищать куки после каждой проверки те





