Here you will learn how to do, what you want to do…
https://russian-dima.wixsite.com/meinewebsite/reading-position
In the example a stripe is used instead of an ANCHOR, to demonstrate better the function. You can combine it with your code.
I expanded this example to a similar situation for your needs…
https://russian-dima.wixsite.com/meinewebsite/lightbox
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 ! ! !