Heres my current code to link two buttons to the same dynamic lightbox.
import wixData from 'wix-data';
import wixWindow from 'wix-window';
/////////////////////////// LIGHTBOX //////////////////////////////////
$w.onReady(() => {
$w("#repeater").onItemReady( ($w, itemData, index) => {
$w("#thumbnail").onClick(() => {
const repeaterItem = itemData;
wixWindow.openLightbox("Learn More Lightbox", repeaterItem);
});
$w("#learnmorebutton").onClick(() => {
const repeaterItem = itemData;
wixWindow.openLightbox("Learn More Lightbox", repeaterItem);
});
});
});
It’s working, but I think it’s not the correct way to write a code for a same function.
Any other way to shorten the code ?