-2

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!

Vander
  • 79
  • 9
  • This should all be possible, but it greatly depends on how the slider is implemented. If you need specific help, please add more details to the question – Rory McCrossan Mar 27 '20 at 09:51

3 Answers3

1

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.

jsnx
  • 11
  • 3
0

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.

Definitive way to trigger keypress events with jQuery

0

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

Alisina Saemi
  • 65
  • 1
  • 9