jQuery orientationchange Event
Alert some text when the user rotates the mobile device:
alert("The orientation has changed!");
Try it yourself »
Definition and Usage
The orientationchange event is triggered when the user rotates the mobile device vertically or horizontally.
Note: To see the effect of the orientationchange event, the user must use a mobile device or a mobile emulator.
Required. Specifies the function to run when the orientationchange event occurs.
The function has an optional event object, which contains an orientation property equal to either "portrait" or "landscape".
Try it Yourself - Examples
Using the event.orientation to return the orientation of the mobile device.
Using the window.orientation property to set different styles between portrait and landscape views.
Thank You For Helping Us!
Your message has been sent to W3Schools.