How do I get the width and height of a HTML5 canvas?

后端 未结 8 1244
陌清茗
陌清茗 2020-12-13 17:04

How can i get the width and height of the canvas element in JavaScript?

Also, what is the \"context\" of the canvas I keep reading about?

8条回答
  •  攒了一身酷
    2020-12-13 17:30

    I had a problem because my canvas was inside of a container without ID so I used this jquery code below

    $('.cropArea canvas').width()
    

提交回复
热议问题