Hi everybody,
I am trying to use a pro gallery as an option selector for users to choose between 3 options that would correspond to the 3 images in the gallery.
So I used this code in order to get the Item index of the last item clicked.
$w ( “#gallery3” ). onItemClicked (( event ) => {
itemIndex = event . itemIndex
console . log ( itemIndex )
})
So it works because the console shows me alternatively 0, 1 or 2 according to what item is clicked. However I can’t seem to be able to retrieve the variable outside the function in order to use it in other functions, in my case that would be mainly in the addtocart product options.
Would there be way to make the itemIndex variable usable outside of the function ?
Thank you in advance !