window.addEventListener('orientationchange', function(event){ if ( window.orientation == 90 || window.orientation==-90 || window.orientation==0 ) { // }})