Skip to content

Instantly share code, notes, and snippets.

@hossinasaadi
Forked from mynameispj/orientationChange.js
Created July 27, 2018 15:12
Show Gist options
  • Save hossinasaadi/e48d9faec1067056657579b7a78ef17e to your computer and use it in GitHub Desktop.
Save hossinasaadi/e48d9faec1067056657579b7a78ef17e 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);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment