XML/HTML Code復制內(nèi)容到剪貼板
- @media screen and (orientation: portrait) {
- /*豎屏 css*/
- }
- @media screen and (orientation: landscape) {
- /*橫屏 css*/
- }
XML/HTML Code復制內(nèi)容到剪貼板
- <link rel="stylesheet" media="all and (orientation:portrait)" href="portrait.css">
XML/HTML Code復制內(nèi)容到剪貼板
- <link rel="stylesheet" media="all and (orientation:landscape)" href="landscape.css">
XML/HTML Code復制內(nèi)容到剪貼板
- //判斷手機橫豎屏狀態(tài):
- window.addEventListener("onorientationchange" in window ? "orientationchange" : "resize", function() {
- if (window.orientation === 180 || window.orientation === 0) {
- alert('豎屏狀態(tài)!');
- }
- if (window.orientation === 90 || window.orientation === -90 ){
- alert('橫屏狀態(tài)!');
- }
- }, false);