How to set a delay on a pop-up with a cookie using Jquery

Hi Guys,

I was working with @vincent his custom cookie pop-up. It is to set a cookie using Jquery, and use it to show a pop-up message or not.

Project is available here: Webflow - Cookie Template

The thing I’m trying to add is a delay on that pop-up, so the pop-up will show up after 10 seconds.

This is the code I managed to make, but for some reason it is not working.

$(document).ready(function(){
	if (!Cookies.get('alert')) {
        setTimeout(function(){
        $('.popup-overlay').show();
    }, 10000);  }
 	  Cookies.set('alert', true, { expires: 1 });
});

Thanks in advance!

setTimeout function your are using should be working. But you do have a 10 seconds long delay.

Why don’t you try using another option instead of setTimeout().

You can do something like, replace whole setTimeout function:

 $('.popup-overlay').delay(500).fadeIn();

Also it is be best to check your project and see you’ve done it, there can be any other issues sometimes.