-
Notifications
You must be signed in to change notification settings - Fork 2
Some Knowledge Points About Developing Keyboard js
Junjia Ni edited this page Sep 27, 2016
·
1 revision
javascript multiple keys pressed at once
preventDefault vs. stopPropagation vs. stopImmediatePropagation
JavaScript Madness: Keyboard Events
Q: how to click link below a higher z-index div?
A: pointer-events: none
Q: how to detecting focus of a browser window?
A:
function onBlur() {
document.body.className = 'blurred';
};
function onFocus(){
document.body.className = 'focused';
};
if (/*@cc_on!@*/false) { // check for Internet Explorer
document.onfocusin = onFocus;
document.onfocusout = onBlur;
} else {
window.onfocus = onFocus;
window.onblur = onBlur;
}
Q: Difference between document.addEventListener and window.addEventListener?
A: The document
and window
are different objects and they have some different events.
Q: How to trigger an event after using event.preventDefault() ?
A: You can trigger
or dispatchEvent
again (You can see Creating and triggering events). Or you can judge it before preventDefault