forked from addyosmani/visibly.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvisibly.html
38 lines (32 loc) · 892 Bytes
/
visibly.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<!DOCTYPE html>
<html>
<head>
<title>visibly</title>
<script type="text/javascript" src="visibly.js"></script>
<script type="text/javascript">
visibly.onVisible(function () {
console.log('page is visible');
});
visibly.onHidden(function () {
console.log('page is hidden');
});
visibly.onVisible(function (){
document.title = 'visible';
});
visibly.onHidden(function (){
document.title = 'hidden';
});
visibly.visibilitychange(function(state){
console.log('Page visibility state is:' + state);
});
visibly.visibilitychange(function(state){
console.log('My visibility is:' + state);
});
</script>
</head>
<body>
<p>
This is a very basic test page demonstrating <strong>visibly</strong> in action. If you create a new tab or click outside the main browser application window, you should see the title of the document change.
</p>
</body>
</html>