The $(document). Keydown (function (e) {
//"write" : volume plus
If (e.w hich==38) {
SetTimeout (function () {
Var I=music. Volume * 100
I++
If (I & gt; {100} I==100)
Var I=I/100
Var v=i.t oFixed (2)
Music. The volume=v
}, 100)
}
})
So with keyup unbundling event look at first, the result of the mistake to write the keydown , surprises incredibly useful, however, what is this principle ah, is really don't understand, you the great god to see

The $(document). Keydown (function (e) {
If (e.w hich==38) {$(document). Off (' keydown)}
})
CodePudding user response:
Keydown () is the keyboard press will triggerKeyup () is the keyboard let go will trigger
One is when press the trigger, a release is triggered when the normal press a button pop-up will soon, unless you grow to have distinction or order difference
CodePudding user response:
I mean, the second piece of code is written keydown ()Why keydown () to the keydown bound events off () () solution, can trigger the setTimeout ()?
A piece of code before the runtime setTimeout () sets not effect
thank you