Created
January 7, 2022 19:21
-
-
Save manuelcanga/45f2909845bfb412a07c5f1b561cd325 to your computer and use it in GitHub Desktop.
Detectar cambio de orientación móvil( JS )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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