I have a slider that when you press left or right key arrow, the carroussel moves to the prev or next image. Is it possible that if i click a div or a link or something it does the same as if i was pressing one of the arrow keys?
Thanks!
I have a slider that when you press left or right key arrow, the carroussel moves to the prev or next image. Is it possible that if i click a div or a link or something it does the same as if i was pressing one of the arrow keys?
Thanks!
Usually you can perform the same action that are triggered by Keyboard Events with clicks on elements like div. I recommend the onclick function. Basically you add an eventlistener to the div and trigger a function that manipulates the slider.
Take a look at this question. You can trigger the Keydown event on one element from another event. So if you click a div you can fire the keydown event of another element.
If you made a slider before try to use owl https://owlcarousel2.github.io/OwlCarousel2/ it is easy to use and work with I use owl in my projects that needed a slider or carousel because it takes a lot of time to make a flexible carousel