window.addEventListener('resize', resizeWidth)
function resizeWidth() {
console.log('resize')
const body = document.getElementsByTagName('body')[0]
var heRatio = window.innerHeight / 1080
var widRatio = window.innerWidth / 1920
var ratio = widRatio + ',' + heRatio
body.style.transform = 'scale(' + ratio + ')'
body.style.transformOrigin = 'left top'
body.style.backgroundSize = '100% 100%'
body.style.backgroundPosition = 'left top'
body.style.width = '1920px'
body.style.height = '1080px'
body.style.backgroundColor = '#021b2d'
}
Created
March 2, 2019 03:08
-
-
Save simonqian/e7fee39c5fe3d3d9759aa72aa5365a0a to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment