Favorites

HTML oncontentvisibilityautostatechange Event Attribute

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
oncontentvisibilityautostatechange
HTML Event AttributeThis event attribute is supported by all modern browsers.
Updated 22nd November 2026

Description

The oncontentvisibilityautostatechange event attribute runs a script on an element with content-visibility: auto when the browser starts or stops skipping the rendering of its contents, usually because the element scrolls into or out of view.

The event is a ContentVisibilityAutoStateChangeEvent with a single property, skipped: true when the contents are no longer rendered and false when they are rendered again. Pages can use it to pause work that is not visible, such as canvas animations or network polling, and resume it when the element becomes relevant again.

Syntax

<element oncontentvisibilityautostatechange="script">

Values

  • scriptThe name of the script to use when the event has been triggered.

Example

<!DOCTYPE html>
<html>
<head>
<title>oncontentvisibilityautostatechange event</title>
<style>
section {
content-visibility: auto;
contain-intrinsic-size: auto 200px;
height: 200px;
background: #dde3ff;
}
</style>
</head>
<body>
<p>Scroll down and watch the log.</p>
<div style="height: 120vh;"></div>
<section oncontentvisibilityautostatechange="log('skipped: ' + event.skipped)">This section uses content-visibility: auto.</section>
<ul id="log" style="position: fixed; top: 0; right: 10px;"></ul>
<script>
function log(text) {
var li = document.createElement("li");
li.textContent = text;
document.getElementById("log").appendChild(li);
}
</script>
</body>
</html>
Open in editor

Browser Support

The following information will show you the current browser support for the HTML oncontentvisibilityautostatechange event attribute. Hover over a browser icon to see the version that first introduced support for this HTML event attribute.

This event attribute is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee