Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
2 contributors

Users who have contributed to this file

@psylone @chrisdavidmills
43 lines (36 sloc) 830 Bytes
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Window resize example</title>
<style>
body {
margin: 0;
}
div {
box-sizing: border-box;
width: 100px;
height: 100px;
background-image: url(bgtile.png);
border: 10px solid white;
}
</style>
</head>
<body>
<div>
</div>
<script>
var div = document.querySelector('div');
var WIDTH = window.innerWidth;
var HEIGHT = window.innerHeight;
div.style.width = WIDTH + 'px';
div.style.height = HEIGHT + 'px';
window.onresize = function() {
WIDTH = window.innerWidth;
HEIGHT = window.innerHeight;
div.style.width = WIDTH + 'px';
div.style.height = HEIGHT + 'px';
}
</script>
</body>
</html>
You can’t perform that action at this time.