Detect change in orientation using javascript

NOTE: orientationChange is deprecated Instead use screen.orientation using the screenOrientation interface var orientation = (screen.orientation || {}).type || screen.mozOrientation || screen.msOrientation; if (orientation === “landscape-primary”) { console.log(“That looks good.”); } else if (orientation === “landscape-secondary”) { console.log(“Mmmh… the screen is upside down!”); } else if (orientation === “portrait-secondary” || orientation === “portrait-primary”) { console.log(“Mmmh… you … Read more