简体   繁体   English

无法在Chrome中捕获ctrl Tab键事件

[英]Not able to capture ctrl tab key event in chrome

I am trying to detect key combination (ctrl+tab), but my code doesn't seem to work. 我正在尝试检测组合键(ctrl + tab),但是我的代码似乎不起作用。 In fact keydown only fires when i press ctrl and as i press tab browser just switches the tab without firing any event. 实际上,只有当我按下ctrl时才会触发keydown,并且当我按下标签页浏览器时,仅在不触发任何事件的情况下切换标签页即可。

$(document).keydown(function(e) {
    if (e.ctrlKey && e.which === 9) {
        alert("CTRL_TAB pressed");
    } });

Can any one help me out here? 有人可以帮我从这里出去吗? what is the issue with this code. 此代码有什么问题。 I am using chrome Version "53.0.2785.116". 我正在使用Chrome版本“ 53.0.2785.116”。

Use Case: I need this to resize my video element. 用例:我需要用它来调整视频元素的大小。 since it is pressed when user in full screen mode. 因为当用户处于全屏模式时被按下。 l can see you tube does the same. 我可以看到你的管子也一样。 when user in full screen mode and ctrl+tab is pressed it will resize the video to small video. 当用户处于全屏模式并按下ctrl + tab时,它将把视频的大小调整为小视频。 I want to achieve similar behaviour. 我想实现类似的行为。

注意:在Chrome中,“保留”了Ctrl + Tab,用于浏览浏览器标签页

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM