Skip to content

Instantly share code, notes, and snippets.

@manuelcanga
Created January 7, 2022 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save manuelcanga/45f2909845bfb412a07c5f1b561cd325 to your computer and use it in GitHub Desktop.
Save manuelcanga/45f2909845bfb412a07c5f1b561cd325 to your computer and use it in GitHub Desktop.
Detectar cambio de orientación móvil( JS )
trasweb.orientationchange = function() {
if(-90 === window.orientation || 90 === window.orientation ) {
alert("Landscape");
}else {
alert("portrait");
}
};
window.addEventListener('orientationchange', function() { trasweb.orientationchange(); } );
trasweb.orientationchange();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment