One Time Pop Up

Hi
I’m using the below code to show a LightBox only to first time visitors
The issue is that it pops up immediately
How can I add a 3sec delay before the LiteBox is shown?
Here is the code

import {local} from ‘wix-storage’;
import wixWindow from “wix-window”;
$w.onReady( function () {
if (!local.getItem(“firstTimePopupShown”)) {
wixWindow.openLightbox(“Announcement”);
local.setItem(“firstTimePopupShown”, “yes”);
}
} );

Try using the JavaScript setTimeout() function.

so what should be the code?
can you help me with that?

Something like this:

import {local} from 'wix-storage';
import wixWindow from "wix-window";

$w.onReady(function () {
  if(!local.getItem("firstTimePopupShown")) {
    setTimeout(function() {wixWindow.openLightbox("Announcement");}, 3000);
    local.setItem("firstTimePopupShown", "yes");
  }
} );

Thanks Sam

It works perfectly

Hi Sam

Just read the previous comments in this chat and it’s really helped my situation.

I also have a Lightbox pop up when visitors enter my site - although, it has a button (“Got It, Thanks!”) and ‘X’ close icon. These buttons don’t currently work (not ‘clickable’), is there a way I can make them work?

Many Thanks
Katie

Ignore me, I think it was a Wix error - all fine now.