Lightbox show/hide local/session

I am trying to hide the lightbox after a client subscribed once already. If the user opens the website home page again the lightbox should not show again.

I used the code in the image below, but it does not work. The lightbox just pop back up again once I open the website again.

I used this. Velo Tutorial: Creating a One-Time Popup | Help Center | Wix.com to assist me with the coding.

Looking forward to hearing from you.

Hi!

Can you please share a link to your site and/or a snippet of the code you use?
It is hard to read and therefor to assist you with your issue. :slight_smile:

Doron.

Hello!

Here is the link - http://arabico.co.za

And here is the code:

I went into Wix Code and then to the home page, my lightbox is called “one”.
Then I went to page and not site and added the code below.

import {session} from ‘wix-storage’;
import wixWindow from ‘wix-window’;

$w.onReady( function () {
if (wixWindow.rendering.env === “browser”) {
// flag is not found
if (!session.getItem(“firstTimePopupShown”)) {
// open popup
wixWindow.openLightbox(“one”);
// set flag for future visits
session.setItem(“firstTimePopupShown”, “yes”);
}
}
} );

Any feedback on this? I can still not make it work.

Hi @lmsdesigninfo !

Is there a reason for you to add this line of code?

if (wixWindow.rendering.env === “browser”)
It seems like without it your code works and it is not required for the use case.

Doron.

Hello @doron-alkalay ,

I removed the code now, but it still pops up.

I used the code that Wix code provided me. They said if I use the precise code I would not have problems.
https://support.wix.com/en/article/wix-code-tutorial-creating-a-one-time-popup


// For full API documentation, including code examples, visit Velo API Reference - Wix.com

import {session} from ‘wix-storage’;
import wixWindow from ‘wix-window’;

$w.onReady( function () {
// if (wixWindow.rendering.env === “browser”) {
// flag is not found
if (!session.getItem(“firstTimePopupShown”)) {
// open popup
wixWindow.openLightbox(“one”);
// set flag for future visits
session.setItem(“firstTimePopupShown”, “yes”);
}
}
//}
);

@lmsdesigninfo

Please share a link to your site so I can inspect it and provide you with a solution.

Doron.

@doron-alkalay ,

Here is the URL http://arabico.co.za/

Thank you.

@lmsdesigninfo I can see in your site that on your Lightbox settings / triggers it is still checked as “automatically appear in all pages”.
Try to change that and see if that works.


Doron.