Live status monitor
now(), status, statusChangedThe page is visible and recent input was detected.
Download Back To CSSScript.Com
Add idle and visibility detection to your web app with ifvisible.js. Listen for blur, focus, idle, wakeup, and page lifecycle events with a single import.
Switch tabs, minimize the browser, scroll, type, or leave the page untouched to see each demo update.
The page is visible and recent input was detected.
The meter resets on mouse, keyboard, touch, scroll, or focus activity.
The counter ticks once per second while the page is active. It pauses when the page is idle or hidden.
The page listens for Page Lifecycle events and reports them in the event stream. The cleanup demo creates a temporary instance, attaches a listener, then destroys it.
<!-- CDN browser global -->
<script src="https://unpkg.com/ifvisible.js"></script>
<script>
ifvisible.on("blur", pauseVideo);
ifvisible.on("focus", resumeVideo);
ifvisible.on("idle", pauseUpdates);
ifvisible.on("wakeup", resumeUpdates);
</script>
// Smart interval and cleanup
import ifvisible, { IfVisible } from "ifvisible.js";
const timer = ifvisible.onEvery(1, poll);
timer.pause();
timer.resume();
timer.stop();
const instance = new IfVisible();
instance.destroy();