This code works great for me but I need the two variables inside the listener to be dynamic numbers representative of the item which you clicked. Right now of course they are hard coded to "7" but all I need is to make them dynamic.
var items = document.getElementsByClassName('largeItems');
for (var i = 0; i < items.length; i++) {
items[i].addEventListener('click', function() {
var itemWays = 7;
var currentItem = 7;
document.getElementById('display').src = detailsImage[itemWays];
}, false);
}
I guess I would like something like this:
var itemWays = this.items[i]; //this.itemIndex that was clicked
var currentItem = this.items[i]; //this.itemIndex that was clicked
Cheers,