There is such a function:

function keyPressHandler(e) { if (!isOpen) return; e = e || window.event; var code = e.keyCode ? e.keyCode : (e.which ? e.which : e.charCode), fnList = { 110 : G.next, // n key 98 : G.prev, // b key 102 : G.zoomNormal, // f key 43 : G.zoomIn, // + 45 : G.zoomOut, // - 27 : G.close // Esc key }; fnList[code] && fnList[code](); } 

It is not clear how to make arrows left and right for them? The list did not find the number of the arrow

    1 answer 1

    Right - 39, Left - 37, up - 38, down - 40.
    You can check with this simple piece:

     "use strict"; document.onkeydown = function(event) { document.querySelector("p > span").innerHTML = event.keyCode; }; 
     body { font-family: Verdana; font-size: 16px; } p { font-size: 18px; padding: 10px; } 
     <p>Код нажатой клавиши: <span>xx</span>.</p>