1

I have tried to use the above method to make the canvas on my webpage responsive to resize, but I am unable to implement it although I have used this before. When I am making the canvas element, I use

var canvas = document.createElement('canvas'); //works
canvas.style.resize = "both";

In addition, I change the position to absolute, style.top, style.left, style.width and style.height if that makes a difference. Am I doing something wrong? If so, how do I allow users to make the canvas resizeabe?

Kavi Vaidya
  • 119
  • 8
  • Related: https://stackoverflow.com/questions/40560568/add-css-resize-property-to-canvas-element Maybe a `resize: both` wrapper with a [ResizeObserver](https://caniuse.com/#feat=resizeobserver) falling back on polling at an interval? (Or some kind of IntersectionObserver hack with elements constantly moved past the edge of the wrapper?) This is assuming you want the canvas to actually resize and not just stretch. – Ry- Feb 21 '19 at 04:17
  • [I answered there](https://stackoverflow.com/questions/40560568/add-css-resize-property-to-canvas-element/54799482#54799482). – Kaiido Feb 21 '19 at 04:54
  • For everyone else with the same question……I think the best solution is @Kaiido then. – Kavi Vaidya Feb 22 '19 at 06:10

0 Answers0