Orientation

The Orientation API detects changes to the device’s position in 3-D space—that is, movement up and down, left and right, and clockwise and counterclockwise. This movement is measured with an accelerometer, and the devices that are most likely to contain one are those that are most portable; mobile phones and tablets move frequently so are very likely to have one, laptops move to some degree so may contain one, and desktops and TVs move so infrequently that it’s very unlikely they’ll have an accelerometer or access to this API.

Using orientation events opens up new possibilities for interaction and navigation; some apps already provide an option to control page scrolling by tilting the device forward or backward, and navigation between ...

Get The Modern Web now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.