Ninja Slider / Posts /

How can I enable keyboard left and right keys to navigate the image slider?

19
Can I enable users  to use keyboard left and right arrow keys to navigate the responsive image slider?
Stephanie  10 years ago   viewed: 18073    

5 Answers

4

Yes you can add the following script into the HTML page to enable the keyboard navigation.

<script> function handleKeyboardNav(e) { if (!e) e = window.event; var kc = e.keyCode; if (kc == 37) nslider.prev(); if (kc == 39) nslider.next(); } function bindKeyDownListener() { if (document.addEventListener) document.addEventListener("keydown", handleKeyboardNav, false); else if (document.attachEvent) el.attachEvent("onkeydown", handleKeyboardNav); } //start the binding bindKeyDownListener(); </script>

The script can be added either at the end of your page(just before the </body> tag), or be added into the head section of the page. 

Milo   10 years ago
2

great post here. . . this really answered my problem, thank you!

aurora
  4 years ago
0

Yes, you can enable keyboard navigation by adding the following script to the  HTML page. 

word search

peterparkerrbu   2 years ago
-3

hi.its not work.plz edit it

yasaman   9 years ago
-6

Since the version v2015.10.21, the keyboard nav function is just built-in. You just need to set: {keyboardNav: true} in the ninja-slider.js (nsOptions).

Milo   9 years ago

   

Your name*
Password
(Optional. Used to modify this post afterwords)
+ =  

Ask your Own Question

  • If your question is related to the topic of this post, you can post your question to this page by clicking the "Post a reply" button at left;

  • When you want to start a new page for your question: