JD already gave you the code. The code is in the API guide written by Wix. Then I gave you a link to an example that uses that code to help you umderstand the concept behind the code.
If you don’t understand the code provided by Wix, then you always have the option to hire someone to do it for you or walk you through it.
Now, looking at your code above … it looks to be correct …but you only shared you code for your page …you have not shared your code for your lightbox. If you don’t have code on your lightbox (like the examples in the 2 links previosuly shared) then your work is incomplete.