Home / eCommerce / gamroud js
Duplicate Snippet

Embed Snippet on Your Site

gamroud js

gamroud js

Code Preview
js
document.addEventListener("DOMContentLoaded", function() {
const popup = document.getElementById("popup");
const iframe = document.getElementById("gumroadIframe");
const close = document.querySelector(".close");
const buttons = document.querySelectorAll(".checkoutButton");
buttons.forEach(function(button) {
button.addEventListener("click", function() {
const gumroadCheckoutUrl = this.getAttribute("data-url");
iframe.src = gumroadCheckoutUrl;
popup.style.display = "block";
});
});
close.addEventListener("click", function() {
popup.style.display = "none";
iframe.src = ""; // stop checkout process
});
window.addEventListener("click", function(event) {
if (event.target === popup) {
popup.style.display = "none";
iframe.src = "";
}
});
});

Comments

Add a Comment