如何使用javascript延迟弹出窗口? [英] How to delay a popup window using javascript ?

查看:77
本文介绍了如何使用javascript延迟弹出窗口?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MailChimp订阅弹出窗口的免费版本(低于2000个订阅者)允许在弹出窗口执行前最多延迟5秒。但我想将弹出窗口延迟45秒。有没有办法让它成真?原始代码如下所示。



The free version (below 2000 subscribers) of MailChimp subscription popup allows at most 5 seconds of delay before the pop up window executes. But i want to delay the popup to 45 seconds. Is there any way to make it happen? The Original code is written below.

<script type="text/javascript"src="//s3.amazonaws.com/downloads.mailchimp.com/js/signup-forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script><script type="text/javascript">require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us11.list-manage.com","uuid":"32e8df9557dd399bb3ba2ae61","lid":"6d35f0128b"}) })</script>

< / script>



我尝试了什么:



我用了超时()和$ .getScript()函数..但它仍然不适合我。也许我还没有正确实现它们。



简易版代码。



</script>

What I have tried:

I used timeout() and $.getScript() function..but it's still not working for me. Maybe i have not implemented them correctly.

Improvised version of code.

<script type="text/javascript"src="//s3.amazonaws.com/downloads.mailchimp.com/js/signup-forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script><script type="text/javascript">setTimeout( function () {
$.getScript(require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us11.list-manage.com","uuid":"32e8df9557dd399bb3ba2ae61","lid":"6d35f0128b"}) }))}, 4500);</script>





好​​像我还在犯一些错误..请你指出我的错误..或者可能是 - 禁用正确版本的代码。



It seems like i am still making some mistake..could you please point out my mistake..or probably re-paste the correct version of code.

推荐答案

.getScript()函数..但它仍然不适合我。也许我还没有正确实现它们。



简易版代码。



.getScript() function..but it's still not working for me. Maybe i have not implemented them correctly.

Improvised version of code.

<script type="text/javascript"src="//s3.amazonaws.com/downloads.mailchimp.com/js/signup-forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script><script type="text/javascript">setTimeout( function () {


.getScript(require([ mojo / signup-forms / Loader ], function (L){L.start({ baseUrl mc.us11.list-manage .com uuid 32e8df9557dd399bb3ba2ae61 lid 6d35f0128b})})}}, 4500 );< / script>
.getScript(require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us11.list-manage.com","uuid":"32e8df9557dd399bb3ba2ae61","lid":"6d35f0128b"}) }))}, 4500);</script>





好​​像我还在犯一些错误..你能吗?请指出我的错误..或者可能重新粘贴正确版本的代码。



It seems like i am still making some mistake..could you please point out my mistake..or probably re-paste the correct version of code.


首先,超时单位是毫秒,所以45秒转换为45000毫秒。

其次,由于脚本已经提供5秒延迟,你需要再延迟40秒(40000毫秒)才能得到总共45秒。

最后,代码:

Firstly, the unit of timeout is milliseconds, so 45 seconds translate into 45000 milliseconds.
Secondly, since the script already provided 5 seconds delay, you need to delay it further for another 40 seconds (40000 milliseconds) to get a total of 45 seconds.
Finally, the code:
setTimeout(function(){
require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us11.list-manage.com","uuid":"32e8df9557dd399bb3ba2ae61","lid":"6d35f0128b"}) })
}, 40000)

这篇关于如何使用javascript延迟弹出窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆