Why is the second event listener calling the next() function instead of the previous() function? 🧐 | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Why is the second event listener calling the next() function instead of the previous() function? 🧐

I’m trying to create a previous button for an image slider but the event listener is calling the next() function instead of the previous() function. Any ideas why this is happening? Here’s my code for reference: https://code.sololearn.com/Wa6a21a8A14a/?ref=app

21st Feb 2021, 2:48 AM
tori the crafter 💛
tori the crafter 💛 - avatar
2 ответов
+ 3
your <img> buttons are absolute positioned and next is above previous button, so only next button is accessible to click... you should use margin instead of padding as quickest fix to position your buttons ;)
21st Feb 2021, 3:37 AM
visph
visph - avatar
0
visph thank you for the explanation! it fixed the issue with my code
21st Feb 2021, 4:07 AM
tori the crafter 💛
tori the crafter 💛 - avatar