File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -311,4 +311,27 @@ user-select:none;
311
311
<!-- 移动web页面自动探测电话号码-->
312
312
<meta name =" format-detection" content =" telephone=no" >
313
313
<meta http-equiv =" x-rim-auto-match" content =" none" >
314
+ ```
315
+
316
+ - [ CSS判断横屏竖屏] ( http://www.w3cways.com/1772.html )
317
+ ``` css
318
+ @media screen and (orientation : portrait ) {
319
+ /* 竖屏 css*/
320
+ }
321
+ @media screen and (orientation : landscape ) {
322
+ /* 横屏 css*/
323
+ }
324
+ ```
325
+
326
+ ``` javascript
327
+ // 判断手机横竖屏状态:
328
+ window .addEventListener (" onorientationchange" in window ? " orientationchange" : " resize" , function () {
329
+ if (window .orientation === 180 || window .orientation === 0 ) {
330
+ alert (' 竖屏状态!' );
331
+ }
332
+ if (window .orientation === 90 || window .orientation === - 90 ){
333
+ alert (' 横屏状态!' );
334
+ }
335
+ }, false );
336
+ // 移动端的浏览器一般都支持window.orientation这个参数,通过这个参数可以判断出手机是处在横屏还是竖屏状态。
314
337
```
You can’t perform that action at this time.
0 commit comments