删除多点触控 Web 应用程序中 touchend 事件上的唯一对象

发布于 2024-12-01 06:54:28 字数 412 浏览 4 评论 0原文

我一直在抓头发,不停地谷歌搜索,但找不到解决方案。通过 touchstart 和 touchmove 事件,我可以从 Touches.identifier 中检索唯一的 ID。这是不可能的,因为触摸不适用于 touchend 事件。

  1. 我想创建一个div并在touchstart发生时分配与touches.identifer相同的id。

  2. 在 touchmove 事件期间更新 div 中的 xy 字符串。

  3. 在touchend事件上使用jqueryremove()删除div。

第3步是我碰壁的地方,我打算使用 $("#"+e.touches.identifier).remove();

有什么建议来实现步骤 3 吗?

非常感谢您的帮助!

Been pulling my hair out and googling non-stop but can't find a solution. With the touchstart and touchmove events, I can retrieve a unique id from touches.identifier. This is not possible as touches does not work with touchend event.

  1. I want to create a div and assign the same id as the touches.identifer when touchstart happens.

  2. Update x y strings in the div during the touchmove event.

  3. Delete the div using jquery remove() on touchend event.

Step 3 is where I'm hitting a wall, i was going to use $("#"+e.touches.identifier).remove();

any suggestions to achieve step 3?

thanks a lot for any help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

囍笑 2024-12-08 06:54:28

任何时候是否有多个这样的 div 存在?如果您在 touchstart 上为 div 分配了一个类似“touch”的类,那么您可以在 touchend 上选择 $("div.touch") 。
不过,我自己才刚刚开始接触触摸事件,所以我不确定。

Is there more than one such div present at any time? If you assign the div a class like "touch" on touchstart then you could select $("div.touch") on touchend.
I'm just starting to get into touch-events myself though, so I'm not sure.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文