Files
visibilityjs/spec/integration.html
2011-09-10 17:21:23 +04:00

34 lines
1.0 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html>
<head>
<meta charset='UTF-8'>
<title></title>
<script src="../lib/visibility.fallback.js"></script>
<script src="../lib/visibility.js"></script>
</head>
<body>
<h1>Visibility.js test</h1>
<p>Page Visibility API <strong id="support"></strong>.</p>
<p>Page is visible for <strong id="counter"></strong> sec.</p>
<script>
var support = document.getElementById('support');
if ( Visibility.isSupported() ) {
support.innerHTML = 'is supported';
} else {
support.innerHTML = 'isnt supported';
}
document.title = Visibility.state();
Visibility.change(function (e, state) {
document.title = state;
});
var sec = 0;
var counter = document.getElementById('counter');
Visibility.every(1000, function () {
counter.innerHTML = sec++;
});
</script>
</body>
</html>