No, I was testing it on my live site. I also tried it on both safari and Firefox. You will see the popup but when you reload the page, you still get the popup.
~Thanks~ Arthur
Hello. I tried that code on the post but the light box is still showing. I made shore that the light box doesn’t automatically often when the page loads. I set a link for it. I am still seeing multiple times. Here is my code:
import wixWindow from 'wix-window';
import { local } from 'wix-storage';
$w.onReady(function () {
let isFirstTime = local.getItem("firstTimePopupShown");
if(!isFirstTime) {
wixWindow.openLightBox("photo")
.then((data) => {
let recevedData = data;
local.setItem("firstTimePopupShown", true);
});
} else {
console.log("Not first time");
}
});
I would really appreciate it if you could spot witch bit needs fixing.
~Thanks for all the help~
Arthur
First of all, you have a spelling error.
Instead of:
wixWindow.openLightBox("photo")
it should be:
wixWindow.openLightbox("photo")
Second, you put the local.setItem in the .then() part which means that it’ll keep showing the popup unless the user closed the popup using code.
You should put the local.setItem() outside the .then() or even in the lightbox code.
Third, the second argument in the local.setItem() should be a string and not a Boolean.
Hi J.D., i’m having the same issue. Would you mind posting the correct code adjusting for the corrections you made when you replied to Arthur? It would be of tremendous help as i’m not familiar with coding.