click event listener automatically triggering
hey folks can anyone check this pen out the click event listener attached to slider in this code is automatically triggering which is supposed to only trigger when I click the slider.
https://codepen.io/adityakirad/pen/oNQPEGW
3 Replies
you're triggering the click yourself:
next.click();
oh yeah
thank you so much for pointing this error out
also, this:
You can just write like this
if you don't mind losing the
console.log
, which exists in the pauseAutoplay
function anyway.
Note the lack of ()
if you're just passing it the function