Jump to content
I dont have cluw what im dowing rong here. Im try to get a canvas in html to match the screen size of the html screen. 
But it woont take the widht or the height. only when is pre programade in like "1080px" :/ is thare a wee to make it full the screen ?

current code 

var width = window.innerWidth
|| document.documentElement.clientWidth
|| document.body.clientWidth;
var height = window.innerHeight
|| document.documentElement.clientHeight
|| document.body.clientHeight;  
console.log("width: "+height+" height: "+width);
document.getElementById("MainFrame").style.border="1px solid black";
document.getElementById("MainFrame").style.width=width;
document.getElementById("MainFrame").style.height="height";  

 

"i reject your reality and substitute my own"

          --- Workstion --- GamePc ---   

"College great Dropout Engineering"

Link to comment
https://linustechtips.com/topic/961850-flexible-canvas-screen/
Share on other sites

Link to post
Share on other sites

Never mind here is the fix 

 

var canvas = document.createElement("canvas");
var ctx = canvas.getContext("2d");
canvas.width = width;
canvas.height = height;
document.body.appendChild(canvas);
}

 

"i reject your reality and substitute my own"

          --- Workstion --- GamePc ---   

"College great Dropout Engineering"

Link to comment
https://linustechtips.com/topic/961850-flexible-canvas-screen/#findComment-11660813
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×