Why is the second event listener calling the next() function instead of the previous() function? ­čžÉ | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
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 Antworten
+ 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