html - Jquery windows.width(height) with overflow -
i have problem size of window. taking size of window var boxwidth = $(window).width(); var boxheight = $(window).height(); and create canvas var canvas: document.createelement("canvas"), start: function() { this.canvas.width = boxwidth; this.canvas.height = boxheight; this.context = this.canvas.getcontext("2d"); document.body.insertbefore(this.canvas, document.body.childnodes[0]); } but got overflow width , height. i want create canvas fit window size. now, got lot of overflow i add margin:0 , padding:0 body well, tried find "normal" solution didn't found, here "tricky" solution. idea assome need customize fit project. the logic create div take full width , height of document , set canvas dimensions according it. final step restore states of elements (html, body etc.) so: $('html, body').css({position: 'relative', height: '100%', overflow:'hidden'}); ...