Is it possible to enable/disable a Lightbox on the client interface of the website (via Wix Code)?

I want to create a basic interface where a logged-in user can press a button to enable a site wide Lightbox (that all users would see). Is this possible? If so, how?

Create a database with a unique ID and set up the onEvent action to update, them make a query for the parameter open which you can set up to TRUE/FALSE

Thanks so much! Are you able to provide me so more detailed instructions?

@noahbschultz What exactly do you want to achieve?

@carlosgalvarez Here’s the real use: I am managing a school website, and need a way for the principal to log into members only page (username and password) and be able toggle a “switch” that activates a site wide pre-designed Lightbox saying school is cancelled.

@noahbschultz Alright, So first thing is to create a member’s page, when you have this, either on the same data base create a field that is called for example schoolCancelled type Boolean.

Then add a switch and a button to save.

On the site code:
Create a query to see if schoolCancelled is true/false then an IF statement to determine if the Lightbox should appear or not. You’ll need to use supressAuth and to the query on the backend.

Notice that only the loggedIn user can make this change, If you want any loggedIn user to make this change you’ll need to use the update wixData option and include and ID that is the same on each case.

I recommend using a box that is collapsed on load and expanded if turned on, this loads faster and you can even set up a customized message.

@carlosgalvarez Can you provide the code for the query and if statement? (THANKS SO MUCH!