Content-Length: 302319 | pFad | http://github.com/roeib/JavaScript-snippets/commit/b2d0d5e7cef104535d7d087dd4a0ba2c1105a5b5
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b34f9d1 commit b2d0d5eCopy full SHA for b2d0d5e
README.md
@@ -49,9 +49,7 @@
49
|43 | [toFixed](#toFixed)|
50
|44 | [generate randomUUID](#generate-random-uuid)|
51
|45 | [structuredClone](#structuredClone)|
52
-
53
54
+|46 | [get device orientation](#get-device-orientation)|
55
56
57
**[⬆ Back to Top](#table-of-contents)**
@@ -981,4 +979,18 @@ console.log("clonedUser.address.street:", clonedUser.address.street);
981
979
// > New Road
982
980
983
+```
+
984
+**[⬆ Back to Top](#table-of-contents)**
985
+### get device orientation
986
987
+Browsers expose a global variable named screen, which we’ll use to access the information we need.
988
989
+```javascript
990
991
+function getOrientation() {
992
+ const isPortrait = screen.orientation.type.startswith('portrait')
993
+ return isPortrait ? 'portrait' : 'landscape'
994
+}
995
996
```
Fetched URL: http://github.com/roeib/JavaScript-snippets/commit/b2d0d5e7cef104535d7d087dd4a0ba2c1105a5b5
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy
0 commit comments