Change cursor over HTML5 Canvas when dragging the mouse

后端 未结 5 1118
梦毁少年i
梦毁少年i 2020-12-16 12:34

I have made a paint brush type of application using the Canvas Tag . I wanted that when the mouse is on the canvas the Cursor Changes ,



        
5条回答
  •  隐瞒了意图╮
    2020-12-16 13:12

    Add a "dragging" class to the canvas while the dragging action is on (and remove it on mouseUp)

    Then add this style:

    canvas {cursor: default;}
    canvas.dragging {cursor: crosshair;}
    

提交回复
热议问题