Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Lock screen orientation to portrait mode
- screen.orientation.lock('portrait');
- // Listen for orientation change events and prevent rotation
- window.addEventListener("orientationchange", function() {
- if (screen.orientation.angle !== 0) {
- screen.orientation.lock('portrait');
- }
- }, false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement