Is there a way in js / jquery how to use these two keyboard shortcuts?
ESCape Button and SHIFT + ESCape Key
when i implemented it using
document.onkeydown = function(e){if (e == null) {keycode = event.keyCode;}
else {keycode = e.which;}
if(keycode == 27){closeAll();}}
$(document).bind('keypress',function(event)
{
if(event.which === 27 && event.shiftKey)
{
closetogether();
}
});
the escape button works fine, but with shift + esc it gets confused, I think, because it does nothing. Do not worry that the function works when I change the key combination 27 to 90 (z), for example, it works fine.
Can someone choose me for a better way?
source
share