Hey there
I tried to make a pro gallery (entries are filled in from a Database) and make an onItemClicked event. but when i click on an image in the gallery, nothing happens. This is the code i used for Testing:
export function test(event, $w) { console.log("test") }
and this is the wix pro gallery:
Am I missing something obvious?
Honestly it appears that the Pro Gallery is very bugged which also results into far longer page loading whenever it's included on a page (at the time that I was working on my site it seemed that even after it was removed that there was still overhead because it was still included upon load through code and the Java sentry was catching all the bugs to prevent the whole thing from crashing).
What I wanted to do was open up a video player on click of the first item, after some failed attempts I tried injecting the video into the player through code, this however caused the video to not be playable due to a separate bug involving the Pro Gallery.
In the end I opted to just go for a workaround with 2 galleries both linked to the same database media gallery, one showing a bigger version of the image and one below it showing smaller images acting as thumbnails. I unshift the thumbnail gallery and add a video thumbnail image from the database, then when I click on that it opens the video player with a youtube video (this also allows me to offload some of the loading to youtube's servers which in turn also means less bandwidth used and it means it doesn't have to be loaded upon webpage load. Then when I click on any other thumbnail image than the first it checks to see if the player is open and if it is it will stop the youtube video playback and hide the player. It then shows the image in the big viewer based on [the item clicked]-1.
All in all this leads to a much faster site load time as well as the functionality we're (most likely) looking for without having to wait for it to be fixed (it's been borked for almost a year now if not longer, so I don't expect it to be fixed soon and at this time it's better to look for workarounds to what you need).
If you're curious as to how it works and what it looks like in action you can have a look at this page: https://www.dennisvdharst.com/project/Ragnarok (desktop only due to not having taken the time yet to fix the mobile version).
Hope this helps a bit!
Cheers,
Dennis van der Harst
OK... I think I found a work around....
We know this doesn't work on Live:
export function gallery1_itemClicked(event) { console.log("galleryClicked"); }
But this seems to work:
$w.onReady(function () {
$w("#gallery1").onItemClicked((event)=>{
console.log("galleryClicked");
});
There seems to be numerous issues with the Pro Gallery causing the Pro Gallery to not be so pro, including videos added to the gallery through code not playing. I would also love to have an update on this, since it's been an issue for months now with no signs of it being very high on the priority list.
For the moment, it's probably better to just use the normal gallery as that does seem to work with item changed and clicked or even use a repeater and make your own.
You're not doing anything wrong, it's not working right now. Maybe @Yisrael (Wix) could check it out?
Has this bug been resolved? I just spent hours in the editor... only to realize it doesn't work on the Live site when published...
hmm it means that the
console.log("test")
part is corrupted
but i do not know how to fix it
doesn't work
try to use onClick: