I have created lightbox which is shown on my Home page with 8sec delay. I want to be shown for visitors only firste time. I have used the code described here: https://support.wix.com/en/article/velo-tutorial-creating-a-one-time-popup
import {local} from 'wix-storage';
import wixWindow from 'wix-window';
$w.onReady(function () {
if(!local.getItem("firstTimePopupShown")) {
wixWindow.openLightbox("Boja web edukacija pitanje");
local.setItem("firstTimePopupShown", "yes");
}
} );
The problem is that the lighbox is still shown on every page load. Is there any other way or is it possible to change this code to make it work?
Page in question is: https://www.gxp-synapse.com/
Thank you!
As the article that you’ve linked to states:
We don’t want the lightbox to show for site visitors unless we specifically open it using code. To make sure the lightbox doesn’t open automatically, select the lightbox and click the Set Triggers button. Set the lightbox so that it does not automatically display on pages.
You need to change Automatically display Lightbox on pages to No . The current setting causes it to appear every time the Home page is loaded.
Also, I notice that you have a few issues with your code. All import statements should be at the top of the file. You should only have one page onReady() function as having more than one can result in unpredictable behavior.
Thank you for your quick response and answer, and also advice about code.