Let the width=document. DocumentElement. ClientWidth
Let height=document. DocumentElement. ClientHeight
Let ele=document. GetElementById (' horizontal - content ')
Let style='
If (width & gt;=height) {//landscape
Style +='width:' + width + 'px; '
Style +='height:' + height + 'px; '
Style +='- its - transform: the rotate (0); The transform: the rotate (0); '
Style +='- its - transform - origin: 0 0; '
Style +='transform - origin: 0 0; '
} else {//vertical screen
Style +='width:' + height + 'px; '
Style +='height:' + width + 'px; '
Style +='- its - transform: the rotate (90 deg); The transform: the rotate (90 deg); '
Style +='- its - transform - origin:' + width/2 + 'px' + width/2 + 'px; '
='transform - origin:' style + + width/+ width/2 + 2 + 'px' 'px; '
}
Ele. Style. CssText=style
CodePudding user response:
Overflow - y: auto; Vertical screenOverflow - x: auto; landscape