Dynamic lightbox on normal page, without using repeaters

Hi everyone,

I’ve gone through the forum in search of a way to add a dynamic lightbox to my page
So far I’ve found the following ways to do it:

  • use a repeater and send the id to the lightbox

  • create a dynamic item page and send the id to the lightbox
    problem is, I need the dynamix lightbox appear on a onClick event, that isn’t a part of a repeater.

I have a timeline on my page, where when you want to read more about the different people, you click on the name and a lightbox appear with the information. Now, I have made it with individual lightboxes, near 200, but it is time consuming to adjust and I’m pretty sure it is one of several reasons why my page is so slow to load.

I’ve created a lightbox that are connected to my database, and I’ve read in the API how to send information to the lightbox and how to unpack it.

What I need help with, is how to figure out how to tell my lightbox which id/title I should use?

I’m thinking of adding my database to my page (even though I don’t use it there) and connect the Title of the database to my text-box/button, and activate it with an click event.

The code on my page would then be like this

exportfunction Moriondo_click(event) {    
    wixWindow.openLightbox("T2_D", 
        {"pageSend1": $w('#title').text        
})}

but I’m using the wrong $w(‘’) and I can’t seem to figure out what it should be - any suggestions?

Looking forward to any suggestions :smile:

The magic that happens when asking questions :sweat_smile:

So I figured it, and just in case someone else is searching I’m posting my code here

wixData.get("Product_Designers", "48de26fe-91cc-452d-9be2-14e180cb46be")
  .then( (results) => {
    item = results; 
    console.log(item.title);
  } )
  .catch( (err) => {
 let errorMsg = err;
  } );


export function Moriondo_click(event) {
    wixWindow.openLightbox("T2_D - Alessandro Volta", {
 "pageSend1": item.title
})
console.log(item.title);
}