From 14bc1517f61b711608d4a571451f7359dc235910 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 4 May 2020 16:51:58 +0200 Subject: [PATCH] Fix get Heigh&Width (#14) --- public/js/theme-matrix.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/public/js/theme-matrix.js b/public/js/theme-matrix.js index 947fbd6..2ef3e37 100644 --- a/public/js/theme-matrix.js +++ b/public/js/theme-matrix.js @@ -2,8 +2,12 @@ var c = document.getElementById("c"); var ctx = c.getContext("2d"); //Get client offsets -var my_height = document.getElementById("main_doc").offsetHeight; -var my_width = document.getElementById("home").offsetWidth; +var my_height = "innerHeight" in window + ? window.innerHeight + : document.documentElement.offsetHeight; ; +var my_width = "innerWidth" in window + ? window.innerWidth + : document.documentElement.offsetWidth; ; //making the canvas full screen c.height = my_height;