I know this is currently not possible with lightboxes, but I was wondering if the code platform would allow me to devise a pop-up/lightbox of sorts that shows some data on a specific page and only for the very first time, not any other repeat visits. Would you say this might now be possible?
As a follow up to this, would it be possible to ask users only that first time to check a checkbox to agree to the little terms they see on the lightbox or custom made pop up, after which a disabled or hidden proceed further button becomes enabled or visible and they can press it to bypass the pop up and proceed to their destination?
Yep, it is possible.
What you wanna do is have code in the page onReady event that checks if this is the first time for a user and if so, shows the popup. The popup can be just a box on the page that you show using the show API or a real lightbox you open using the wix-window.openLightbox API.
As for knowing if this is the first time or not, it depends on what you define as first time.
For returning Site Members, you can store a value in the database that indicates if this is the first time or not. You will need to use the wix-data APIs for this option.
For returning Anonymous users you can store a value in local storage (which is device specific) and based on this decide if to show the lightbox. You will need to use the wix-storage APIs for this option.
Yes. So much yes to the answers I am reading here this morning! These answers are totally canceling out my dire frustration this week (I am presenting the site for the first time later this week) with my Wix load speed issues that cannot for the love of all that is holy be addressed in the short term.
Hi,
Iâm also interested about doing the same kind of thing. I would like to know how to display a cookie message (thanks to a lightbox) but only for the first time. How can I know if the user comes for the first time and then, never display the image again ? Thanks for the answer.
Hola lo que quieres es esto
import {local} from âwix-storageâ ;
import wixWindow from âwix-windowâ ;
$w.onReady( function () {
if (!local.getItem( âfirstTimePopupShownâ )) {
setTimeout( function () {wixWindow.openLightbox( âBienvenidoâ );}, 1000 );
local.setItem( âfirstTimePopupShownâ , âyesâ );
}
} );
Donde dice Bienvenido el es nombre de tu lightbox, en propiedades puedes ver cual es el nombre, o puedes ponerlo tu mismo. luego tiene un retraso de apariciĂłn de 1 minuto, los 1000 representan ese minuto, si quieres que dure mas tiempo cambias el valor.
Hi Don,
This thread is over 3 years old. Please create a new post for your issue and provide in English all relevant information, code, and screenshots. Here are our post guidelines . Thank you