Only show Section on initial visit / load

Hi,

On initial visit I would like users to see the initial landing section and then once they have clicked to enter the site (currently using the SKIP button ‘skip-enter’ class as the trigger) and they will no longer see the landing section when they reload / revisit the site.

I have added the code from the thread below however I cannot get this to work.

https://discourse.webflow.com/t/cookie-consent-modal-wrapper-but-just-on-the-first-load-possible/32168?u=samliew

This is the code I have in the tag:

<script>
var Webflow = Webflow || [];
Webflow.push(function() {

  // Load cookie library
  $.getScript('https://cdn.rawgit.com/js-cookie/js-cookie/v2.1.2/src/js.cookie.js', function() {

    // If cookie found (already shown)
    if(Cookies.get('welcome') !== undefined) {

      // Hide cookie notice (change jQuery selector to match your own)
      $('.welcome').remove();
    }

    // On button click
    $('.skip').click(function() {
      // Calculate when you want to display the notice again (change 15 to number of minutes you want)
      var expireTime = new Date(new Date().getTime() + 60000 * 15);
      // Set this cookie
      Cookies.set('notice', 'shown', { expires: expireTime });
    });
  });

});
</script>

Many thanks,

Darren

The staging site is https://fountech.webflow.io
Read only: https://preview.webflow.com/preview/fountech?utm_source=fountech&preview=ef33e53e24185bcd0c2013a2d0d7feea

Hi @samliew - just wondering if you could take a look at this?

Many thanks

Darren

Update - I have updated the code as there seemed to be an error however I cannot paste into this thread for some unknown reason?

Hey @thinkrandom

<div>code block</code>

After pasting your code, select it and click the “preformatted text” button. Hope that helps.

Thanks @matthewpmunger - nit sure how I missed that!

I have now added in the code.

1 Like

I have now resolved this this: ‘welcome’ swapped out for 'notice.

Hey!
What is the final code that you used?
Working on a project which needs a similar function.