Streaming live at 10am (PST)

Here is how to add cookies to a custom modal

Find the full code here:

var cookieName = 'modalClosed';

if(typeof Cookies.get(cookieName) !== 'undefined') {

$('.close-modal-bg, .close-modal').on('click', function(){
Cookies.set(cookieName, 'ok', { expires: 7 });

Here is how to create a custom modal:


I’m not sure why mine isn’t working. I copied directly from the code provided and followed your instruction very closely. I’m stumped.


Thank you so much for sharing this video, it helped me alot

Thanks and regards.:slight_smile:

1 Like

all classnames in the code should be lowercase. The reason why is because when Webflow publishes your code, they remove spaces, dashes and capital letters from class names.

Hope this helps :slight_smile:

That was it, thanks.

1 Like

Same here mikesellr - can’t for the life of me get this to work - my modal just keeps opening every time i refresh, try different browser etc… you have any luck yet?

Mine was just that my classes had uppercase. Switched to lower case and issue was resolved.

Ah thanks for the fast reply! I tried that too but not solving it….

Please, share with us the read-only link for your website and the code that you are using for your website so we can help you

Thanks for the reply Jeandcc! I figured out! :wink:

1 Like

Quick correction to your list @PixelGeek- dashes are not replaced on publish and can be safely used as in class-name.


thanks for the correction :slight_smile:

how to save something-of-productlist shown in a div-block that i like on a website to a page with all products-i-like into a may-be-i-will-buy-list? for a-not-ecommerce site possible? for example I-like-old-buildings-site …

Hi Nelson,

Thanks for this super useful!

if I want the cookie to expire after 6 hours do I change the following
Cookies.set(cookieName, ‘ok’, { expires: 7 });
Cookies.set(cookieName, ‘ok’, { expires: .25 }); ?


Check the link above that teaches how to provide something different than days for the expire section of the code

1 Like


So I’m going with:

var inSixHours = 0.25;
Cookies.set(cookieName, ‘ok’, { expires: inSixHours });


1 Like