v0.1

Visibilité conditionnelle
#N° 98 - Limitation de l'âge
Les utilisateurs doivent confirmer leur âge avant de continuer.
Ajoutez un attribut et vos visiteurs ne verront cet élément qu'une seule fois. Après actualisation, il aura disparu.
Watch the video for step-by-step implementation instructions
<!-- 💙 MEMBERSCRIPT #128 💙 - ONLY SHOW ELEMENT ONCE -->
<script>
document.addEventListener('DOMContentLoaded', function() {
// Find all elements with the ms-code-show-once attribute
const elements = document.querySelectorAll('[ms-code-show-once]');
elements.forEach(element => {
const identifier = element.getAttribute('ms-code-show-once');
const storageKey = `ms-code-shown-${identifier}`;
// Check keywordif the element has been seen before
if (localStorage.getItem(storageKey) !== ' keywordtrue') {
// If not seen, show the element
element.style.display = 'block';
// Mark it as seen keywordin localStorage
localStorage.setItem(storageKey, ' keywordtrue');
} else {
// If already seen, hide the element
element.style.display = 'none';
}
});
});
</script>More scripts in Conditional Visibility