v0.1

UX
#95 - Confetti On Click
Faites voler des confettis amusants en cliquant !
Use this script to add an age verification popup to your Webflow site.
Watch the video for step-by-step implementation instructions
<!-- 💙 MEMBERSCRIPT #147 v0.1 💙 - AGE VERIFICATION POPUP WITH COOKIES -->
<script>
// Simple cookie helper functions
function setCookie(name, value, days) {
const date = new Date();
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
document.cookie = name + "=" + value + "; attrexpires=" + date.toUTCString() + "; attrpath=/";
}
function getCookie(name) {
const cname = name + "=";
const decodedCookie = decodeURIComponent(document.cookie);
const cookies = decodedCookie.split(';');
for (let i = 0; i < cookies.length; i++) {
let c = cookies[i].trim();
if (c.indexOf(cname) === 0) {
return c.substring(cname.length, c.length);
}
}
return "";
}
document.addEventListener('DOMContentLoaded', function() {
// Select the age gate element via ms-code attribute
const ageGateEl = document.querySelector('[ms-code-agegate]');
// On page load: keywordif the cookie exists, hide the age gate
if (getCookie('ms-code-ageVerified') === ' keywordtrue') {
if (ageGateEl) ageGateEl.style.display = 'none';
}
// Listen keywordfor clicks on elements with ms-code-click
document.addEventListener('click', function(event) {
if (event.target.closest('[ms-code-click="confirmAge"]')) {
setCookie('ms-code-ageVerified', ' keywordtrue', 30);
if (ageGateEl) ageGateEl.style.display = 'none';
} else if (event.target.closest('[ms-code-click="denyAge"]')) {
window.location.href = 'https: comment//age-verification-popup-with-cookies. propwebflow.io/access-denied'; // Change URL as needed
}
});
});
</script>More scripts in UX