JS: Touch equivalent for mouseenter

后端 未结 5 877
太阳男子
太阳男子 2021-02-04 01:55

is there a touch equivalent of the mouseenter.

I would like to detect if user slide on my DIV.

I prefer a solution depending directly on the target element not o

5条回答
  •  旧巷少年郎
    2021-02-04 02:41

    I just wanted to say thank you to the previous poster. His suggestion worked perfectly. And I've been struggling to find a solution to this for weeks. If you're using Svelte within your pointerdown handler function I would suggest using:

    const pointerDownHandler = (event) => {
        // whatever logic you need
        event.target.releasePointerCapture(event.pointerId);
    }
    

    He's accurate in saying this part is key. It will not work without it.

提交回复
热议问题