Mouseleave triggered by click

前端 未结 6 1562
囚心锁ツ
囚心锁ツ 2021-01-01 11:38

I have an absolutely-positioned div, and I\'m trying to keep track of when the mouse moves over it, and when the mouse leaves. Unfortunately clicking on the text in the box

6条回答
  •  佛祖请我去吃肉
    2021-01-01 12:12

    Check if the primary button is pressed with MouseEvent.buttons.

    tooltip.onmouseleave = (e) => {
      if (e.buttons !== 1) {
        console.log('tooltip mouse OUT')
      }
    }
    

提交回复
热议问题