Why is the second event listener calling the next() function instead of the previous() function? šŸ§ | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Respostas
+ 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