We should use the jquery events here. So, `$(window).blur(function() { ... })`.