Chevereto 更改图像预览快捷键

在查看图像预览的时候,关闭图片的快捷键是 “X” ,而我们想使用 “Esc” 键代替它,

作者 Rodolfo 给出的方案是:

//原代码
    keys: {
        83: 'select',
        76: 'like',
        70: 'flag',
        69: 'edit',
        65: 'move',
        46: 'delete',
        88: 'close', //<--- 此处需要修改 (88=>27)
        37: 'prev',
        39: 'next',
    },
        
//修改后
    keys: {
        83: 'select',
        76: 'like',
        70: 'flag',
        69: 'edit',
        65: 'move',
        46: 'delete',
        27: 'close',
        37: 'prev',
        39: 'next',
    },        

对应键代码详细如下表

In every browser there are three possible kinds of client-side events triggered when a keyboard key is pressed or released:

  1. keydown event
  2. keypress event
  3. keyup event

The keydown event occurs when the keyboard key is pressed, and it is followed at once by the execution of keypress event.
The keyup event is generated when the key is released.

Here is a sample program using the keycodes You can view it's source to the the actual coding

Keyboard key PressedJavaScript Key Code value
backspace8
tab9
enter13
shift16
ctrl17
alt18
pause/break19
caps lock20
escape27
page up33
Space32
page down34
end35
home36
arrow left37
arrow up38
arrow right39
arrow down40
print screen44
insert45
delete46
048
149
250
351
452
553
654
755
856
957
a65
b66
c67
d68
e69
f70
g71
h72
i73
j74
k75
l76
m77
n78
o79
p80
q81
r82
s83
t84
u85
v86
w87
x88
y89
z90
left window key91
right window key92
select key93
numpad 096
numpad 197
numpad 298
numpad 399
numpad 4100
numpad 5101
numpad 6102
numpad 7103
numpad 8104
numpad 9105
multiply106
add107
subtract109
decimal point110
divide111
f1112
f2113
f3114
f4115
f5116
f6117
f7118
f8119
f9120
f10121
f11122
f12123
num lock144
scroll lock145
My Computer (multimedia keyboard)182
My Calculator (multimedia keyboard)183
semi-colon186
equal sign187
comma188
dash189
period190
forward slash191
open bracket219
back slash220
close braket221
single quote222

来源:http://gcctech.org/csc/javascript/javascript_keycodes.htm

松鼠大大

若不是真的废物,谁又愿意混吃等死呢?

暂无评论

  1. 然后水了一整页的键位表 ::funny:04::

    • 卧槽,这都被你发现了 ::funny:03::

发表评论

您的电子邮件地址不会被公开,必填项已用*标注。

相关推荐

微信扫一扫,分享到朋友圈

Chevereto 更改图像预览快捷键