我正在使用MailChimp,我想在按钮点击时显示注册表单。它们提供模式弹出窗口,但它仅在页面加载时或在x秒后加载。
我只想在用户点击按钮时显示屏幕。谁能以正确的方式引导我?
这是我从MailChimp获得的代码。
<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.us12.list-manage.com","uuid":"5fa6528f19f668f9c0c842dab","lid":"5319bf6b62"}) })</script>
谢谢!
答案 0 :(得分:0)
试试这个:
<!-- This is the HTML element that, when clicked, will cause the popup to appear. -->
<button id="open-popup">Subscribe to our mailing list</button>
<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>
function showMailingPopUp() {
require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us11.list-manage.com","uuid":"YOUR_UUID_GOES_HERE","lid":"YOUR_LID_GOES_HERE"}) })
document.cookie = "MCEvilPopupClosed=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
};
document.getElementById("open-popup").onclick = function() {showMailingPopUp()};
</script>
只需确保更新"mc.us11.list-manage.com"
"uuid"
和"lid"
以匹配mailchimp为您提供的内容。
答案 1 :(得分:0)
经过大量研究后,我找到了解决方案。
在我的情况下,只需在onclick函数正文后添加2行以删除Cookie
<script type="text/javascript" charset="utf-8" src="//downloads.mailchimp.com/js/signup-forms/popup/1.0/popup.js"></script>
<script src="//s3.amazonaws.com/downloads.mailchimp.com/js/signup-forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script>
function openPOPUP(){
require(["mojo/signup-forms/Loader"], function (L) { L.start({"baseUrl": "mc.us18.list-manage.com", "uuid": "YOUR UUID", "lid": "YOUR LID"})});
document.cookie = "MCPopupClosed=; path=/; expires=Thu, 01 Jan 1970 00:00:00 UTC";
document.cookie = "MCPopupSubscribed=; path=/; expires=Thu, 01 Jan 1970 00:00:00 UTC";
}
<input type="button" onclick="openPOPUP();" value="Subscribe" id="button-color" class="newslatter-new">