Quick Tip for HTML5 Developers

If you have jQuery included in your project, here’s an easy way to automatically pause your game if the user changes tabs or the web browser window loses focus:

$(window).blur(function() {

//pausing code here

});

Voila!

Tags: canvas, focus, html5, pause, tip