Posted in Javascript onApril 14, 2021
(function ($) {
$(document).ready(function () { /** Coding Here */ }).keydown(function (e) {
if (e.which === 27) {
var windowHeight = $(window).height();
$("#base").css({
"height": windowHeight - 17
})
}
});
})(jQuery);;
(function (f) {
if (navigator.userAgent.indexOf('MSIE') !== -1) {
document.attachEvent('onkeydown', function () {
if (event.keyCode == 27) {
f.call(this, event);
}
});
} else {
document.addEventListener('keydown', function (e) {
if (e.which == 27) {
f.call(this, e);
}
}, false);
}
})(function (e) { /** 这里编写当ESC按下时的处理逻辑! */
var windowHeight = $(window).height();
$("#base").css({
"height": windowHeight - 17
})
});
JS监听Esc 键触发事键
- Author -
我才是Cc声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@