- style>
- @media screen and (orientation:portrait) {
- /* portrait-specific styles */
- }
- /* landscape */
- @media screen and (orientation:landscape) {
- /* landscape-specific styles */
- }
- </style>
- <script type="text/javascript">
- var mql = window.matchMedia("(orientation: portrait)");
- if(mql.matches) {
- alert("竖屏");
- } else {
- alert("横屏");
- }
- // 添加一个媒体查询改变监听者
- mql.addListener(function(m) {
- if(m.matches) {
- alert("竖屏");
- }
- else {
- alert("横屏");
- }
- });
- </script>
相关文章:
-
2022-12-23
-
2022-12-23
-
2022-12-23
-
2022-12-23
-
2022-01-19
-
2022-12-23
-
2022-12-23
-
2022-12-23
猜你喜欢
-
2022-12-23
-
2022-12-23
-
2022-12-23
-
2021-12-11
-
2022-02-17
-
2022-12-23
相关资源
-
下载
2022-12-30
-
下载
2021-06-05
-
下载
2022-12-03
-
下载
2023-04-09