Multiple Image Views w/ EventListeners
I have a scroll view with multiple imageViews inside.
I'm adding the imageViews in a for loop (with at least 10-20).
How would I properly add an eventListener for a click on each imageView and then pass in a photo id?
1 Answer
-
Within the for loop do this:
var photoId = ## image.photoId = photoId; image.addEventListener('click', function(e) { photoPage.photoId = e.source.photoId; tab.open(photoPage,{animated:true}); });