开发者

Use alt + shift + a as a hotkey in IE 7/8

开发者 https://www.devze.com 2023-04-12 17:01 出处:网络
I am trying to attach an keyup listener on document object. I want to know when user pres开发者_如何学运维ses alt + shift + a or alt + shift + w. Both work in Chrome and Firefox. In IE, alt + shift +

I am trying to attach an keyup listener on document object. I want to know when user pres开发者_如何学运维ses alt + shift + a or alt + shift + w. Both work in Chrome and Firefox. In IE, alt + shift + w works, but alt + shift + a doesn't. I know IE has few hot keys reserved, but why is taking over alt + shift combination, too? Is there a way to prevent this or is it a flow in IE?

Demo: http://jsfiddle.net/HnD5E/


You can get around this behavior with a keydown event.

$(document).keydown(function (e) {
            if (e.keyCode == 65 && e.altKey) {
                 e.preventDefault();
            }
        }).keyup(...);

http://jsfiddle.net/HnD5E/4/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号