Crosbrowser & lightweight way to check if user is looking at the page or interacting with it….

Fuente: Ifvisible.js by serkanyersen