How a Carousel works?

 Page Visibility Level 2 (w3.org)

How it works:

The carousel is a slideshow for cycling through a series of content, built with CSS 3D transforms and a bit of JavaScript. It works with a series of images, text, or custom markup. It also includes support for previous/next controls and indicators.

In browsers where the Page Visibility API is supported, the carousel will avoid sliding when the webpage is not visible to the user (such as when the browser tab is inactive, the browser window is minimized, etc.).

The animation effect of this component is dependent on the prefers-reduced-motion media query. See the reduced motion section of our accessibility documentation.

Please be aware that nested carousels are not supported, and carousels are generally not compliant with accessibility standards.

const videoElement = document.getElementById("videoElement"); // Autoplay the video if application is visible if (document.visibilityState === "visible") { videoElement.play(); } // Handle page visibility change events function visibilityListener() { switch(document.visibilityState) { case "hidden": videoElement.pause(); break; case "visible": videoElement.play(); break; } } document.addEventListener("visibilitychange", visibilityListener);

Comments

Popular Posts