ifvisible.js is a crosbrowser & lightweight way to check if user is looking at the page or interacting with it.
Website Demo
Subscribe to email newsletter for latest jQuery plugins & tutorials.