[英]jQuery closest element that's not self
Trying to use document.elementFromPoint()
during a touchEnd
event. 尝试在
touchEnd
事件期间使用document.elementFromPoint()
。 It's working correctly, in that it's showing the highest visible element, but the problem is that I'm transforming the element that is moving so it's always the most visible. 它工作正常,因为它显示的是可见度最高的元素,但是问题是我正在变换正在移动的元素,因此它始终是最可见的。
I'm wondering if there's a combination of elementFromPoint
and not()
that will work? 我想知道是否有
elementFromPoint
和not()
的组合会起作用? I've been testing and have only been returned undefined
. 我一直在测试,只是返回
undefined
。
var x = orig.changedTouches[0].pageX,
y = orig.changedTouches[0].pageY,
d = $(document.elementFromPoint(x, y)).not('.moving');
"moving" is a class that denotes elements that are being transformed. “移动”是一个类,它表示要转换的元素。 These elements are being returned with
document.elementFromPoint()
. 这些元素将通过
document.elementFromPoint()
返回。 Logically, I'm looking for any element at those coordinates that is not moving. 从逻辑上讲,我正在寻找那些不动的坐标上的任何元素。
Unfortunately, I don't think this functionality can be achieved in a standard way using Javascript. 不幸的是,我认为使用Javascript无法以标准方式实现此功能。 However, this developer has devised a strategy that allows for tracking custom layers that should support what you need to do: http://www.vinylfox.com/forwarding-mouse-events-through-layers/
但是,该开发人员设计了一种策略,该策略允许跟踪应支持您需要执行的操作的自定义层: http : //www.vinylfox.com/forwarding-mouse-events-through-layers/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.