Streaming live at 10am (PST)

Here is how to add cookies to a custom modal

Find the full code here:

<script>
var cookieName = 'modalClosed';

if(typeof Cookies.get(cookieName) !== 'undefined') {
$('.modal').remove();
}

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

Here is how to create a custom modal:

3 Likes

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.

https://preview.webflow.com/preview/thelovelylittleshoptemp?utm_medium=preview_link&utm_source=dashboard&utm_content=thelovelylittleshoptemp&preview=b27294c0e392d8e89b9de7275276bcff&mode=preview

hello,

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.

2 Likes

thanks for the correction :slight_smile: