Created
August 26, 2013 14:24
-
-
Save fharper/6341953 to your computer and use it in GitHub Desktop.
Resize the canvas for different window size
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
"use strict"; | |
function resizeCanvas() { | |
var canvas = document.querySelector("#canvas"); | |
var context = canvas.getContext("2d"); | |
//Need to set the canvas size here, as it zoom with CSS | |
canvas.width = window.innerWidth; | |
canvas.height = window.innerHeight; | |
} | |
window.onload = function() { | |
resizeCanvas(); | |
}; | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment