Lightbox Show Hide
Add checkbox to avoid showing Lightbox every time

All Snippets
Limitation in Wix
Lightboxes shows up every time user loads a page where it is triggered. This is really bad UX.
Solution
Give user an option as a checkbox to not display the lightbox again.
How to setup
Add a checkbox to your liightbox, set default value to unchecked
Copy first Snippet on the lightbox page
Copy 2nd snippet on the page you want to trigger the lightbox. If you want to trigger on every page, then add this snippet to masterPage.js
Rename the variables for name and id to your values
New to our site? Please see our quick tutorial on how to work with our snippets
Setting | Description |
---|---|
$w.onReady(function () {
LightboxHide({
name: 'Lightbox Name',
checkboxId: '#checkbox5'
})
});
function LightboxHide({name:o,checkboxId:e}){
const{local:t}=require("wix-storage-frontend");$w(e).onClick((()=>{
t.setItem("__dontShowPopup__"+o,"true")}))}
$w.onReady(function () {
LightboxShow({
name: 'Lightbox Name'
})
})
function LightboxShow({name:o}){
const{openLightbox:e}=require("wix-window-frontend"),{local:n}=require("wix-storage-frontend");
"true"!==n.getItem("__dontShowPopup__"+o)&&e(o)}

Title

Title