Last active
September 17, 2019 07:11
-
-
Save CatChen/06063464c7c205fe477243f18b439f27 to your computer and use it in GitHub Desktop.
MailChimp Popup on Click Event
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="//downloads.mailchimp.com/js/signup-forms/popup/unique-methods/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script> | |
<script type="text/javascript"> | |
function displayDialog() { | |
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"; | |
window.dojoRequire(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"mc.us18.list-manage.com","uuid":"a7af3978c0ebeaff2b102af2f","lid":"68a7bcc816","uniqueMethods":true}) }); | |
} | |
</script> | |
<script type="text/javascript"> | |
if (document.querySelectorAll) { | |
window.addEventListener('load', function() { | |
window.dojoRequire(["mojo/signup-forms/Loader"]); | |
}); | |
var links = document.querySelectorAll('a[href="https://chen.cat/subscribe-to-blogs"]'); | |
for (var i = 0; i < links.length; i++) { | |
links[i].addEventListener('click', function(event) { | |
displayDialog(); | |
event.preventDefault(); | |
}); | |
} | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment