Search This Blog

2022/11/29

Add event listen to window focus in and out

var blurFuc = function() {
    console.log(focus out)
}

var focusFuc = function() {
    console.log(focus in)
}

window.addEventListener('blur', blurFunc);
window.addEventListener('focus', focusFunc);