Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Handling Fullscreen Events | Clipboard and Fullscreen Features
JavaScript Web APIs Essentials

bookHandling Fullscreen Events

index.html

index.html

style.css

style.css

script.js

script.js

copy

When you use the Fullscreen API, you might want your page to react whenever the user enters or exits fullscreen mode. The fullscreenchange event lets you detect these changes. In the example above, the code adds event listeners for both fullscreenchange and fullscreenerror. When the fullscreenchange event fires, the button label updates to reflect the current fullscreen state, and a message displays to show whether fullscreen mode was entered or exited. This makes the user interface more responsive and clear. If something goes wrong, the fullscreenerror event displays an error message so users know what happened. By using these events, you can keep your UI in sync with the actual fullscreen state, giving users a seamless experience.

question mark

What is the purpose of the 'fullscreenchange' event in the Fullscreen API?

Select the correct answer

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 2. Kapittel 4

Spør AI

expand

Spør AI

ChatGPT

Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår

bookHandling Fullscreen Events

Sveip for å vise menyen

index.html

index.html

style.css

style.css

script.js

script.js

copy

When you use the Fullscreen API, you might want your page to react whenever the user enters or exits fullscreen mode. The fullscreenchange event lets you detect these changes. In the example above, the code adds event listeners for both fullscreenchange and fullscreenerror. When the fullscreenchange event fires, the button label updates to reflect the current fullscreen state, and a message displays to show whether fullscreen mode was entered or exited. This makes the user interface more responsive and clear. If something goes wrong, the fullscreenerror event displays an error message so users know what happened. By using these events, you can keep your UI in sync with the actual fullscreen state, giving users a seamless experience.

question mark

What is the purpose of the 'fullscreenchange' event in the Fullscreen API?

Select the correct answer

Alt var klart?

Hvordan kan vi forbedre det?

Takk for tilbakemeldingene dine!

Seksjon 2. Kapittel 4
some-alt