js if tab is active
$(window).on("blur focus", function(e) {
var prevType = $(this).data("prevType");
if (prevType != e.type) { // reduce double fire issues
switch (e.type) {
case "blur":
// do work
break;
case "focus":
// do work
break;
}
}
$(this).data("prevType", e.type);
})var interval_id;
$(window).focus(function() {
if (!interval_id)
interval_id = setInterval(hard_work, 1000);
});
$(window).blur(function() {
clearInterval(interval_id);
interval_id = 0;
});
Also in JavaScript:
- ClassNotFoundException: com.fasterxml.jackson.core.JsonGenerator
- Upload image via ajax (jquery)
- popper.js install npm
- on enter key press react
- document getelementsbyclassname not getting all elements
- mongoose max record
- UTL ,Raw json
- toastify js
- change color of strike through line of text in react native
- google script range get cell values
- javascript datetime
- javascript get remaining time from start and end datetime
- delete backspace on string js
- object object javascript
- how to install chalk in node js
- jquery version how
- javascript transfer to another page
- json object check if key exists java
- mysql JSON_SEARCH LIKE
- js function
- c# newtonsoft serialize dictionary to json
- Error: Can't resolve 'fs' webpack
- js input trigger change event when set value with js
- express request path