A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/en-US/docs/Web/API/ScreenOrientation/change_event below:

ScreenOrientation: change event - Web APIs

ScreenOrientation: change event

Baseline 2023

Newly available

The change event of the ScreenOrientation interface fires when the orientation of the screen has changed, for example when a user rotates their mobile phone.

Syntax

Use the event name in methods like addEventListener(), or set an event handler property.

addEventListener("change", (event) => { })

onchange = (event) => { }
Event type

A generic Event.

Example

In the following example, the change callback prints the new screen orientation type and angle.

screen.orientation.addEventListener("change", (event) => {
  const type = event.target.type;
  const angle = event.target.angle;
  console.log(`ScreenOrientation change: ${type}, ${angle} degrees.`);
});
Specifications Browser compatibility

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4