top of page

Lightbox Show Hide

Add checkbox to avoid showing Lightbox every time

Untitled (800 x 600 px) (1).png

Lightbox Show Hide

Popup Custom

Ecom Add To Cart

Dataset Search

Dynamic Pages Previous Next

Dynamic Pages Show Hide Element

Forms Save Progress

Dataset Sort

Show Hide Elements

Dataset Pagination

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

  1. Add a checkbox to your liightbox, set default value to unchecked

  2. Copy first Snippet on the lightbox page

  3. 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

  4. 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

View tutorials

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

bottom of page