But there is still a solution: When opening the page, you can use window.orientation to determine whether the webpage is horizontal or vertical. If it is vertical, add styles to the entire page
transform: rotate(90deg);
In this way, your page will display the horizontal screen effect.
The front end cannot control the horizontal and vertical screen of the mobile phone, but it can be judged through css conditions:
Portrait:
@media screen and (orientation:portrait){
#wrap{
display:none;
}
}
Landscape:
@media screen and (orientation:landscape){
#wrap{
display:block;
}
}
For example, when the screen is vertical, the prompt text is displayed: Please browse horizontally. Use css operation to show and hide after horizontal screen.
Can judge and then prompt the user to rotate
Or listen for rotation events
css media query can also be judged
But there is still a solution:
When opening the page, you can use window.orientation to determine whether the webpage is horizontal or vertical. If it is vertical, add styles to the entire page
In this way, your page will display the horizontal screen effect.
The front end cannot control the horizontal and vertical screen of the mobile phone, but it can be judged through css conditions:
Portrait:
Landscape:
For example, when the screen is vertical, the prompt text is displayed: Please browse horizontally.
Use css operation to show and hide after horizontal screen.