Pretty useful if you can't achieve your aims with pure portrait/landscape media queries !

window.onorientationchange = function()  {
    // Your code here
}