Answer the question
In order to leave comments, you need to log in
How to find out the real size of the browser window in js in order to draw canvas without scrolls?
If you set the padding to zero, as in the code below -
<style>
* {padding: 0; margin: 0;}
</style>
var viewPort = {
width: window.innerWidth,
height: window.window.innerHeight
};
var canvas = document.createElement('canvas');
canvas.width = viewPort.width;
canvas.height = viewPort.height;
document.body.appendChild(canvas);
Answer the question
In order to leave comments, you need to log in
Try somehow using the new vh and vw units.
Unless, of course, you need old browsers.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question