I have a bunch of previous and next buttons on more multiple mobile carousels on the same page, and I'd like to assign event handlers to the previous and next buttons of each carousel for when they're touched. However, chrome's mobile emulator doesn't respond to any touches, and I think it may be a problem with passing the value of i
into my handlers.
for (let i = 0; i < number_of_carousels; i++){
prev_button_list[i].addEventListener("touchend", handleMoveToPrevSlide(i));
next_button_list[i].addEventListener("touchend", handleMoveToNextSlide(i));
}
Also, I got the lists of elements with the following:
prev_button_list = document.getElementsByClassName("carousel-prev");
next_button_list = document.getElementsByClassName("carousel-next");
Maybe I'm missing something?