问题
$(window).blur(function(){ windowFocus = false; }).focus(function(){ windowFocus = true; });
The problem is that in firefox 3, when I create a new tab, it does not lose windowFocus. Where as in ff2, ie7 it does lose. In ff3 it only loses window focus when i select another program.
Anyone have a solution to this problem?
回答1:
Attach to the events on document
instead:
$(document).blur(function(){
windowFocus = false;
}).focus(function(){
windowFocus = true;
});
...FWIW, this appears to have been fixed in FF3.5.
来源:https://stackoverflow.com/questions/844689/firefox-3-window-focus-and-blur