i have added a button i want to make that button on click it will show a lightbox is it possiple to do that ?
Yes,
To open a lightbox:
import wixWindow from 'wix-window';
wixWindow.openLightbox("LightboxName");
To close lightbox:
import wixWindow from 'wix-window';
wixWindow.lightbox.close();
It is also possible to add props when opening or closing the lightbox
For more information:
Good luck!
Roi
thank you for help
Can this be done with ‘onMouseIn’ and ‘onMouseOut’ or does it need to be a click?
The commands to open and close a Lightbox can basically be anywhere. I tried it with onMouseIn myself and it worked fine.
I am trying to do this… could someone help? Is it possible to do the on mouse hover in and out for a button to show a lightbox? I have buttons I want to assign to lightboxes but only show on hover in. thanks! Not sure how to do this code and not seeing an example for the mouse in mouse out and how to assign to the light boxes. thanks!
Hi Sandy,
Here are the APIs (including examples) for onMouseIn() and onMouseOut() .
You can open Lightbox using the openLightBox() function of wix-window .
For more information on the Lightbox, see the wix-window.lightbox API .
A simple example of opening a Lightbox on hover in:
import wixWindow from 'wix-window';
// ...
$w("#myElement").onMouseIn( (event, $w) => {
wixWindow.openLightbox("LightboxName", dataObj);
} );
Good luck,
Yisrael
Hey guys, I am trying to link a repeater button to lightbox but it doesn’t seem to open. Below is my code:
import wixWindow from ‘wix-window’;
export function reviewbutton_click(event, $w) {
wixWindow.openLightbox(“lightbox1”);
}
Any help would be great!
Mark
Is the reviewbutton_click() being triggered? You can add a console.log() statement to be sure. You may not have properly connected the buttons in your repeater items.
Are you getting any messages in the console log? Errors?
Thanks Yisrael, I figured it out
Hi,
I am needing to build a flexible sampling lead-in for my subscription based WIX site. When a a non-member views a blog page restricted for members, I want to automatically display a lightbox. When a member views the same blog page, I don’t want to display the lightbox.
Any ideas on how to code this? Is it possible to place an IF statement in the page to automatically display the lightbox if not a member, otherwise not display the lightbox?
Can someone help with the code?
This is an old post from 2018, so being closed.
If you search the forum you will find previous posts that show you code examples for having a lightbox open or closed depending on the user stauts.
If you need help then please add a new forum post as per the Forum Guidelines