jQuery,根据父级获取拖动上的上一个和下一个元素
我正在尝试创建一个时间表。有一个拖动器元素和一些动态创建的时间范围(DIV)。当您拖动拖动器时,代码将指示左近和右近的 div 是什么。该代码有效,您可以在 http://jsfiddle.net/3pXC9/15/ 中查看它。只需拖动红色手柄即可,蓝点在左,红点在右。
问题是我只需要为具有相同父级、相同层的元素获取下一个左侧和右侧。现在代码正在从两个层获取所有关键帧元素。 有办法做到这一点吗?如何获取具有相同父级的下一个和上一个元素?
I am trying to create a timeline. There is a dragger element and some dynamically created timeframes (DIVs). When you drag the dragger the code will indicate what is the near left and near right div. The code works, you can see it at http://jsfiddle.net/3pXC9/15/ . Just drag the red handle, the blue dot is the left and the red is the right.
The problem is that I need to get the next left and right only for elements that have the same parent, same layer. Right now the code is getting all the keyframes elements from both layers.
Is there a way to do that? How can I get the next and previous element that have the same parent?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是你想要的吗?
http://jsfiddle.net/3pXC9/17/
我分离了选择最接近关键帧的函数然后将图层的容器作为参数发送。
Is this what you want?
http://jsfiddle.net/3pXC9/17/
I separated the function that selects the closest keyframes and then you send in the container for the layer as a parameter.