Webflow sync, pageviews & more.
NEW

Age Gate Modal Overlay

Example

Age Gate Modal Overlay

Description

Add a birthday/age gate modal confirmation to your Webflow site via this simple Javascript code snippet.

Instructions

  1. Add the Javascript code snippet to your Webflow custom code before the closing body tag
  2. Update the classes and IDs to your own IDs and classes

Javascript snippet


<script src = "https://cdnjs.cloudflare.com/ajax/libs/js-cookie/2.2.1/js.cookie.js"></script>

<script>

		//Modified from Finsweets age gate redirect hack: https://www.finsweet.com/hacks/21/
    
    // if no validAge cookie then show the age gate
    if (!Cookies.get('validAge')) {
        $('.age-gate-modal-wrapper').show();
    }

    // when form is submitted check if the birthday is above 18 years old
    $("#verify-form").on('submit', function(e) {

        // get year, month & day values
        const year = $('#verify-year').val();
        const month = $('#verify-month').val();
        const day = $('#verify-day').val();

        // make date string
        const date = year + '/' + month + '/' + day;

        // if user's age >= 18
        if (getAge(date) >= 18) {

            // prevent form from submitting
            e.preventDefault();

            // give the user a validAge cookie
            Cookies.set('validAge', true, {
                expires: 365
            });
            // hide the age gate popup
            $('.age-gate-modal-wrapper').hide();

        }
    });

    // getAge function
    function getAge(dateString) {
        const today = new Date();
        const birthDate = new Date(dateString);
        let age = today.getFullYear() - birthDate.getFullYear();
        const month = today.getMonth() - birthDate.getMonth();
        if (month < 0 || (month === 0 && today.getDate() < birthDate.getDate())) {
            age--;
        }
        return age;
    }

</script>

CSS snippet

HTML snippet

Hide Element After Click w/Cookie

Hide Element After Click w/Cookie

Hide an element on your Webflow site after click with a cookie via this Javascript snippet. This is perfect for welcome modals, cookie notifications, notification alerts and other items that only need to be displayed a single time.

Setting & Manipulating Cookies

Setting & Manipulating Cookies

Set, modify and manipulate cookies on your Webflow site via this Javascript code. This allows you to set a cookie, get a cookie, modify a cookie, check a cookie and delete a cookie on your Webflow site.

Redirect Logged in User to Dashboard

Redirect Logged in User to Dashboard

1

Redirect a Memberstack user to your Webflow user dashboard if they are logged in to your Webflow Memberstack membership site.

Display/Hide Items based on Count

Display/Hide Items based on Count

1

Hide/show elements on your Webflow Memberstack site based on a conditional value with this Javascript snippet. A great way to implement a credit based system or value based conditional logic for your Memberstack Webflow site.

CMS Based Password Collection Template

CMS Based Password Collection Template

Add a CMS based password to your Webflow template page via this Javascript code. This allows you to password protect a Webflow CMS template page based on a password in the Webflow CMS collection.

Redirect Users to Membership Dashboard

Redirect Users to Membership Dashboard

3

Redirect a Memberstack user to a designated dashboard page based on their package subscription in Webflow. This Javascript snippet will allow you to easily redirect users to their proper dashboard page based on their membership plan on your Webflow Memberstack site.

Wait X before showing modal again

Wait X before showing modal again

Automatically show a modal or div after X minutes once the window/element has been hidden/closed in Webflow. A great way of showing advertisements, alert messages and so forth based on a time interval between the last time it was viewed.

DRAG
Real-time sorting by
Hide/show Items based on URL Parameter

Hide/show Items based on URL Parameter

Show or hide divs or elements based on the parameter within a URL in Webflow. This Javascript code allows you to make your Webflow site even more dynamic by allowing you to customize elements on the page based on the URL parameter provided.

Reload Page after Form Submit

Reload Page after Form Submit

Automatically refresh your Webflow site's page after a form submit with this Javascript snippet. A great way of indicating that a form has been submitted to a user or refreshing the page for another submission.

Count Up Numbers on Page Scroll

Count Up Numbers on Page Scroll

When scrolling down the page numbers count up as they enter browser view via this Javascript snippet on your Webflow site. An easy way to add number count up to your Webflow site.

Prevent Input Zoom Scaling on Mobile

Prevent Input Zoom Scaling on Mobile

Prevent an input form zoom scaling on mobile on your Webflow site. This allows for a better user experience based on your sites design rather than mobile OS zoom default properties.

SVG Clip-path for Custom Image Cropping

SVG Clip-path for Custom Image Cropping

Create a responsive clip path for images using SVG shapes in Webflow.This allows you to create unique shaped images using SVG paths rather than DIVs or similar methods.

International Flags Phone Number Input

International Flags Phone Number Input

Add international flags to a phone number for input in Webflow. Adding this allows for a unique way of adding international flags to a phone form field in your Webflow site.

Infinite CSS Marquee/Ticker Logo

Infinite CSS Marquee/Ticker Logo

An easy way to utilize CSS for Logo marquees and other sections in your Webflow site. An easier way to create an infinite looping marquee on your Webflow site than creating them manually with Webflow interactions.

Truncate multi-line text with Ellipse

Truncate multi-line text with Ellipse

Do you want consistency with your Webflow designs? Truncate multi-line texts with ellipses based on 2 or 3 lines of your choosing via CSS. This helps keep your designs uniformed without needing to set max height limitations by truncating text that goes beyond a certain length.

DRAG
Real-time sorting by