You will find the code inside the example.
All i added to the existing code is this…
export function anchor1_viewportLeave(event) {
session.setItem('Email', $w("#inputMain").value);
setTimeout(()=>{wixWindow.openLightbox("Lightbox1");},350)
}
Of course you have also to input an anchor onto your page. This is the “onLeave-Event”. That means, when the Anchor leaves the Viewport, an event is fired up.
In this case the Light-Box-Call starts (waits for 0,35sec. and open a Light-Box with the transfering DATA).
Also do not forget to connect your button with the CODE ! ! !
@russian-dima
Thank you Dima but I do not see how this is related to my problem
I am trying to open a Lightbox when the scroll reaches a certain element on the page…
@contact13073
Have you checked my site ?
In console output you can see like
Viewport entered
Views port leaves .
Have you checked that your function call is happening using console.log ?
Ok, do the following steps:
-check the name of your Lightbox —> Lightbox1 that is correct?
-delete your anchor and add a new one → give it the following ID → anchor1 -do NOT connect the anchor with the code (already done in the code)!
-put in the following code into the CODE-section of your choosen page
-check one more time the position of your anchor (does it leave and enters the viewport, when do some scrolling)?
After everything is checked, test the action in LIVE-MODE.
Take a look into console (as already mentioned by Er.Muthu).
Press F-12 on your Keyboard (if using google-chrome) and go to the CONSOLE.
While doing some action on the site, take carefully a look onto the output of CONSOLE. You should see —> “Viewport entered”
Thank you for both of you.
The console indicates the viewport entered but writes: There is no lightbox with the title “lightbox1”
But this is exactly the ID of my lightbox: