This page demonstrates the Page Visibility API.
The API can be used to check if a web page is visible.
When you minimise this page or move to another tab, a visibilitychange event is triggered. The video pauses and the page title stops changing – and vice versa if you return to the page.
For more information, please see my blog at samdutton.wordpress.com.
To detect element visibility (rather than page visibility) take a look at the jquery.inview plugin.