MouseEvent.metaKey

MouseEvent.metaKey 为只读属性,返回一个布尔值,在鼠标事件发生时,用于指示 Meta 键是按下状态(true),还是释放状态(false)。

备注: 在 MAC 键盘上,表示 Command 键(),在 Windows 键盘上,表示 Windows 键()。

语法

var metaKeyPressed = instanceOfMouseEvent.metaKey

返回值

一个布尔值。

示例

 function goInput(e) {
 // 检测 metaKey 值
   if (e.metaKey) {
        // 继续处理事件
     superSizeOutput(e);
   } else {
     doOutput(e);
   }
 }

规范

Specification
UI Events
# dom-mouseevent-metakey

浏览器兼容性

BCD tables only load in the browser

相关链接