Check current device orientation

Checks device orientation in two ways by using window and screen object window.orientation returns one of 4 items: 0, 90, -90 and 180 screen.orientation returns: portrait-primary, landscape-primary, landscape-secondary, portrait-secondary
function checkScreenOrientation() {
	return screen.orientation;
}

function checkWindowOrientation() {
	return window.orientation;
}

Responses

0 Replies