0

Друзья! Прошу помощи. Есть модальное окно, которое открывается по ссылке. Какие нужно внести в него исправления, чтобы это окно открывалось автоматически при загрузке страницы, но не сразу, а по истечении например 60-и секунд?

Вот код скрипта:

jQuery(document).ready(function () {
//Set the lightbox position in the center of screen
jQuery('.lightbox').css({
    position: 'absolute',
});
//Show the lightbox with background if the link is clicked
jQuery('a.authorization-open').click(function(e) {
    e.preventDefault();
    jQuery('.lightbox').fadeIn(800);
    jQuery('.authorization-overlay').fadeIn(800);
});
//Hide the lightbox and background if the close link or overlay div is clicked
jQuery('a.authorization-close').click(function(e) {
    e.preventDefault();
    jQuery('.lightbox').fadeOut(800);
    jQuery('.authorization-overlay').fadeOut(800);
});
});

Заранее очень благодарен за помощь!

2 ответа 2

1

Можно попробовать через .delay():

var delay = 5; // 5 sec.

$('.lightbox').delay(delay * 1000).fadeIn(800);

Смотрите результат

0
1

Поробуйте так

setTimeout(function(){
    jQuery('a.authorization-open').click();
    // или 
    jQuery('a.authorization-open').trigger('click');
}, 60000);
0

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.