Hey all, I’m trying to figure out why my code isn’t working for my company’s site, and for the life, I don’t see the problem.
We want to have a registration pop up for non-members on their first time visiting the site in a session. However, the popup is too image-heavy for it to populate quickly on mobile, so we have a special popup for that. As it stands, it looks like the popup opens fine on desktop, but won’t ever show on mobile. Any advice?
This is the JS for the event:
import{local} from 'wix-storage';
import wixWindow from 'wix-window';
import wixUsers from 'wix-users';
$w.onReady(function () {
if(wixWindow.formFactor === "desktop"){
if (wixUsers.currentUser.loggedIn) {
local.setItem("firstTimePopupShown", "yes");}
if(!local.getItem("firstTimePopupShown")) {
wixWindow.openLightbox("registerAd");
local.setItem("firstTimePopupShown", "yes");
}}
if(wixWindow.formFactor === "mobile"){
if (wixUsers.currentUser.loggedIn) {
local.setItem("firstTimePopupShown", "yes");}
if(!local.getItem("firstTimePopupShown")) {
wixWindow.openLightbox("registerAdMobile");
local.setItem("firstTimePopupShown", "yes");
}}
} );