我的网站是https://urbancitee.com,我使用的是Ella主题,Shopify平台。
我使用了这个主题的内置弹出代码:
<script type="text/javascript">// <![CDATA[
jQuery(document).ready(function() { //
var $modalParent = jQuery('div.newsletterwrapper'),
modalWindow = jQuery('#email-modal'),
emailModal = jQuery('#email-modal'),
modalPageURL = window.location.pathname;
modalWindow = modalWindow.html();
modalWindow = '<div id="email-modal">' + modalWindow + '</div>';
$modalParent.css({'position':'relative'});
jQuery('.wrapper #email-modal').remove();
$modalParent.append(modalWindow);
if (jQuery.cookie('emailSubcribeModal') != 'closed') {
openEmailModalWindow();
};
jQuery('#email-modal .btn.close').click(function(e) {
e.preventDefault();
closeEmailModalWindow();
});
jQuery('body').keydown(function(e) {
if( e.which == 27) {
closeEmailModalWindow();
jQuery('body').unbind('keydown');
}
});
jQuery('#mc_embed_signup form').submit(function() {
if (jQuery('#mc_embed_signup .email').val() != '') {
closeEmailModalWindow();
}
});
function closeEmailModalWindow () {
jQuery('#email-modal .modal-window').fadeOut(600, function() {
jQuery('#email-modal .modal-overlay').fadeOut(600, function() {
jQuery('#email-modal').hide();
jQuery.cookie('emailSubcribeModal', 'closed', {expires:1, path:'/'});
});
})
}
function openEmailModalWindow () {
jQuery('#email-modal').fadeIn(600, function() {
jQuery('#email-modal .modal-window').fadeIn(600);
});
}
});
// ]]
// ]]></script>
请帮我添加延迟到这个弹出窗口,大约60秒。非常感谢!!!
答案 0 :(得分:1)
您可以使用setTimeout()方法:
https://www.w3schools.com/jsref/met_win_settimeout.asp
https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout
答案 1 :(得分:0)
您使用setTimeout并以毫秒数包含所需的延迟。
if (jQuery.cookie('emailSubcribeModal') != 'closed') {
setTimeout(openEmailModalWindow, 60000);
};