Skip to content

Instantly share code, notes, and snippets.

@mynameispj
Last active September 3, 2020 19:39
Show Gist options
  • Save mynameispj/5234017 to your computer and use it in GitHub Desktop.
Save mynameispj/5234017 to your computer and use it in GitHub Desktop.
jQuery event that fires when the orientation (portrait, landscape) of a mobile device changes
window.addEventListener("orientationchange", function() {
alert(window.orientation);
//do whatever you want on orientation change here
}, false);
@biesior
Copy link

biesior commented Sep 3, 2020

agreed, also keep in mind that you have 3-rd orientation to handle: square

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment