'onmousedrag' event js

前端 未结 5 933
情深已故
情深已故 2020-12-18 11:24

I have some code that works each time onmouseclick and continuously onmousemove when I set them accordingly. I am looking for a way to combine the two (i.e. like a click and

5条回答
  •  眼角桃花
    2020-12-18 11:54

    really simple... I hope :)

    when the mousedown event is triggered, set a global "dragging" variable to true. Then when mouseup is triggered, set it to false.

提交回复
热议问题