I am working on a simple slide-in menu system. I'd like to be able to close a menu by hitting the ESC key.
Here's my current code:
http://jsfiddle.net/3w539Lct/3/
Line 126 of my Javascript, you can see:
$( document ).on( 'keydown', function ( e ) {
if ( e.keyCode === 27 ) { // ESC
$(".menu-wrap").prop("checked", false);
}
});
However, this doesn't work. Can someone help?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…