--- title: orientationchange slug: Web/API/Window/orientationchange_event translation_of: Web/API/Window/orientationchange_event ---
L'evento orientationchange si scatena quando viene modificato l'orientamento del dispositivo.
| Property | Type | Description |
|---|---|---|
target {{readonlyInline}} |
{{domxref("EventTarget")}} | The event target (the topmost target in the DOM tree). |
type {{readonlyInline}} |
{{domxref("DOMString")}} | The type of event. |
bubbles {{readonlyInline}} |
{{jsxref("Boolean")}} | Whether the event normally bubbles or not. |
cancelable {{readonlyInline}} |
{{jsxref("Boolean")}} | Whether the event is cancellable or not. |
// Note that "orientationchange" and screen.orientation are unprefixed in the following
// code although this API is still vendor-prefixed browsers implementing it.
window.addEventListener("orientationchange", function() {
alert("the orientation of the device is now " + screen.orientation.angle);
});