Answer the question
In order to leave comments, you need to log in
How to track two key presses at the same time?
When you press one key, hold it down, a handler is executed, and during this you need to press another key and another handler will work once so that after it is completed, tracking of the previous button is continued.
In general, you need to do something similar to the events in games, when the hero can move and when you press the button, he jumps, but does not stop moving
Answer the question
In order to leave comments, you need to log in
First, you can use this plugin .
Secondly, as far as I know, it is impossible (so at the system level) to track the pressing of two buttons of the same type, for example H + L. For example, my keyboard does not respond to such combinations at all. If you need to track hotkeys, then here is an example from the Internet
function keydown(evt){
if (!evt) evt = event;
if (evt.ctrlKey && evt.altKey && evt.keyCode==115){ //CTRL+ALT+F4
alert("CTRL+ALT+F4");
}
else if (evt.shiftKey && evt.keyCode == 9){ //Shif+TAB
alert("Shift+TAB");
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question