UI 核心(UI Core)
描述:一个相对于数字值的关键代码描述的映射。
jQuery.ui.keyCode
keyCode | 类型 |
---|---|
BACKSPACE | Integer |
COMMA | Integer |
DELETE | Integer |
DOWN | Integer |
END | Integer |
ENTER | Integer |
ESCAPE | Integer |
HOME | Integer |
LEFT | Integer |
PAGE_DOWN | Integer |
PAGE_UP | Integer |
PERIOD | Integer |
RIGHT | Integer |
SPACE | Integer |
TAB | Integer |
UP | Integer |
箭头按键测试。
$( document ).on( "keydown", function( event ) { switch( event.keyCode ) { case $.ui.keyCode.LEFT: console.log( "left" ); break; case $.ui.keyCode.RIGHT: console.log( "right" ); break; case $.ui.keyCode.UP: console.log( "up" ); break; case $.ui.keyCode.DOWN: console.log( "down" ); break; } });