I have cards of Projects on my Portfolio Website created using repeater connected to a Dataset.
What I want to Achieve:
One of the Project (title: “ELM”) is in progress and not live on website yet. So I created a ‘Coming Soon’ lightbox (named “ComingSoon”). Since this project is still in works, I want to open the lightbox when the repeater card of “ELM” is clicked. Rest of the projects are live and redirect the user to external URLs from the database.
What I have coded:
//To open Coming Soon Lightbox.
export function workItemContainer_click(event, $w) {
$w('#workRepeater').forEachItem(($item, itemData, index) => {
if (itemData.title === "ELM") {
console.log('entered if clause'); //for debug purpose
wixWindow.openLightbox("ComingSoon");
}
});
}
The problem I am facing:
The lightbox opens for all project cards and seem to ignore the if condition. (The developer console also shows ‘entered if clause’ on click of any project card from repeater).
I do not understand code very well. I would appreciate if the solutions you mention are elaborate. Thanks.