Return to Snippet

Revision: 36993
at December 2, 2010 08:40 by peterbelsky


Initial Code
detectOrientation();
	window.onorientationchange = detectOrientation;
	function detectOrientation(){
		if(typeof window.onorientationchange != 'undefined'){
			if ( orientation == 0 ) {
				 //Do Something In Portrait Mode
			}
			else if ( orientation == 90 ) {
				 //Do Something In Landscape Mode
			}
			else if ( orientation == -90 ) {
				 //Do Something In Landscape Mode
			}
			else if ( orientation == 180 ) {
				 //Do Something In Landscape Mode
			}
		}
	}

Initial URL
http://www.devinrolsen.com/javascript-mobile-orientation-detection/

Initial Description

                                

Initial Title
Javascript Mobile Orientation Detection

Initial Tags

                                

Initial Language
JavaScript