Tag Archives: portrait
Detecting iPhone’s orientation
Detecting the iPhone’s orientation on a website is very easy: the only thing needed is a little bit of Javascript to listen to the onorientationchange event: window.onorientationchange = function() { if (window.orientation) document.body.setAttribute('class', 'landscape'); else document.body.setAttribute('class', 'portrait'); } window.onload = function() { window.onorientationchange(); } The window.orientation variable can [...]
