Background
This is a rather complicated problem that I struggled with for several days. I am trying to display the lessons in a slide show format. So, the lesson consists of different slides. Now overlaying on each slide is a canvas element that matches the size of the screen.
canvas.width = document.body.clientWidth; canvas.height = document.body.clientHeight;
This allows the teacher to draw notes and highlight parts of the lesson on the canvas.
Problem
The content of the slide is made up of HTML, it looks like when the slide is loading.

When resizing a page ...

So the problem is that the canvas image changes according to the aspect ratio of the page with CSS.
#theCanvas { position:fixed; top:0; right:0; bottom:0; left:0; }
But the actual HTML remains the same size, but re-arranges the output points of the line. Bad.
What i tried
First, I make all my HTML elements according to the width and height of the window using CSS:
h1 { font-family: 'Open Sans Condensed', sans-serif; color: #222222; font-weight: 200; font-size: 5.9vw; } h2 { font-family: 'Open Sans Condensed', sans-serif; color: #222222; font-weight: 200; font-size: 3.0vh; } h4 { font-family: 'Open Sans Condensed', sans-serif; color: #444444; font-weight: 200; font-size: 2vmin; } p { font-family: 'Open Sans Condensed'; font-size: 2vmin; font-weight: 200; }
Next, I save and resize the canvas image using:
window.onresize = function(event) { var data = canvas.toDataURL();
Full screen result (1920 pixels wide)

When the window button is resized (1200 pixels)

This is pretty close.
Problem
Now, when I drag the corner of the window to resize, this happens:

Question
1 - Why does the window.onresize function not start when I manually resize the corner of the window?
(bonus question) Am I going to do it right, or will it be more trouble than putting canvas on HTML elements for interactive lessons?