以弹出形式延迟成功消息

时间:2018-08-10 03:10:21

标签: javascript popup delay mailchimp

我在MailChimp中弹出了一个订户表单,但是他们没有选择来延迟成功消息的显示时间。我在成功消息上插入了文本和链接,因此我需要延迟时间,直到消失20-30秒为止。这是代码:

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

1 个答案:

答案 0 :(得分:0)

将黑猩猩代码包装到您自己的函数中,以根据需要延迟。你可以做这样的事情,

<script>
   setTimeout(function() {
   var script   = document.createElement("script");
   script.type  = "text/javascript";
   script.src   = "https://downloads.mailchimp.com/js/signup-forms/popup/embed.js";
   document.body.appendChild(script);

   var script1 = document.createElement("script");
   script1.type = "text/javascript";
   script1.text = "require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us7.list-manage.com","uuid":"f09b264fd1dc6dc20e24858c5","lid":"4e2a4d310f"}) })"
   document.body.appendChild(script1);
   }, 2000); // delay opening by 2 seconds
</script>