orientationchange
orientationchange
이벤트는 장치의 방향이 바뀔 때 호출 된다.
General info
- Specification
- Interface
-
Event
- Bubbles
-
No
- Cancelable
-
No
- Target
-
Screen
- Default Action
-
None
Properties
Property | Type | Description |
---|---|---|
target 읽기 전용 |
EventTarget |
The event target (the topmost target in the DOM tree). |
type 읽기 전용 |
DOMString |
The type of event. |
bubbles 읽기 전용 |
Boolean |
Whether the event normally bubbles or not. |
cancelable 읽기 전용 |
Boolean |
Whether the event is cancellable or not. |
Example
js
// Note that "orientationchange" and screen.orientation are unprefixed in the following
// code although this API is still vendor-prefixed browsers implementing it.
screen.addEventListener("orientationchange", function () {
alert("the orientation of the device is now " + screen.orientation);
});