-
Notifications
You must be signed in to change notification settings - Fork 676
/
Copy pathviewer-pause.js
58 lines (57 loc) · 1.68 KB
/
viewer-pause.js
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// check if browser window has focus
var notIE = (document.documentMode === undefined),
isChromium = window.chrome;
if (notIE && !isChromium) {
// checks for Firefox and other NON IE Chrome versions
$(window).on("focusin", function() {
// tween resume() code goes here
setTimeout(function() {
// console.log("focus");
pauseAnimation = false;
animate();
// $('html, body').css('filter', 'blur(0px)');
}, 100);
}).on("focusout", function() {
// tween pause() code goes here
console.log("blur");
pauseAnimation = true;
});
} else {
// checks for IE and Chromium versions
if (window.addEventListener) {
// bind focus event
window.addEventListener("focus", function(event) {
// tween resume() code goes here
setTimeout(function() {
// $('html, body').css('filter', 'blur(0px)');
// console.log("focus");
pauseAnimation = false;
animate();
}, 100);
}, false);
// bind blur event
window.addEventListener("blur", function(event) {
// tween pause() code goes here
// console.log("blur");
pauseAnimation = true;
// $('html, body').css('filter', 'blur(2px)');
}, false);
} else {
// bind focus event
window.attachEvent("focus", function(event) {
// tween resume() code goes here
setTimeout(function() {
// console.log("focus");
pauseAnimation = false;
animate();
// $('html, body').css('filter', 'blur(0px)');
}, 100);
});
// bind focus event
window.attachEvent("blur", function(event) {
// tween pause() code goes here
pauseAnimation = true;
// console.log("blur");
});
};
};