In my site, I have two different gallerys with different designs, and I want Gallery A to scroll to the i’th image whenever image with index i is clicked in Gallery B. I’m using the onItemClicked event to do this, but the event.itemIndex always evaluates to zero regardless of what item I selected.
export function gallery2_itemClicked(event) {
let indexClicked = event.itemIndex
console.log(event.item.title + ": " + indexClicked)
let currentIndex = $w('#gallery1').currentIndex
console.log(currentIndex)
let numNext = (currentIndex - indexClicked) % 32
console.log("Num scrolls: " + numNext)
for (var i = 0; i < numNext; i++) {
$w('#gallery1').next()
}
}
In the snippet above, the event.item.title is correct (it always shows the correct title of the image clicked), but indexClicked is always zero. Neither of the galleries are pro galleries. Any solution to this?