Orienting Mobile Layout with JavaScript

While working on a mobile layout I started thinking about a lightweight solution to detecting a screen reorientation on a mobile device. Things like jQuery Mobile contain code to do this, but I wanted to get to the guts of the matter. These two links provide a basic outline of the code to make this functionality possible:

  • http://davidwalsh.name/orientation-change
  • http://jbkflex.wordpress.com/2011/12/06/429/

The first link covers not only JavaScript but also CSS. I’m sure there’s more out there but this stuff answered the questions I had.

Leave a Reply