#128 - Elemente ausblenden, nachdem sie gesehen wurden

Fügen Sie ein Attribut hinzu, und Ihre Besucher werden dieses Element nur einmal sehen. Nach der Aktualisierung ist es verschwunden.

Video Tutorial

tutorial.mov

Watch the video for step-by-step implementation instructions

The Code

24 lines
Paste this into Webflow
<!-- 💙 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>

Script Info

Versionv0.1
PublishedNov 11, 2025
Last UpdatedNov 11, 2025

Need Help?

Join our Slack community for support, questions, and script requests.

Join Slack Community
Back to All Scripts

Related Scripts

More scripts in Conditional Visibility