恢复“z-index”在拉斐尔
我有一个 Raphael set() 包含一个文本节点和一个圆圈。我在集合上使用 toFront() 方法来确保所有悬停元素都可见。
但是,当鼠标离开元素时,我希望它将元素返回到其初始的“z-index”,我想我使用 insertBefore() 或 insertAfter() 来执行此操作。但我如何知道在哪里重新插入元素呢?我是否可以在 set() 上使用一种方法来对其所有元素执行此操作,或者我是否需要编写自定义方法?
在相关说明中,我将集合存储为 javascript 对象的属性
this.marker = this.canvas.set()
但是 this.marker 根本没有显示在 firebug 中,尽管悬停触发了 attr 更改(并且依赖于通过父对象查找 .marker )持续发生。有谁知道为什么 this.marker 没有出现在 dom 中?
I have a Raphael set() containing a text node and a circle. I'm using the toFront() method on the set to make sure all of the hovered elements are visible.
However, when the mouse leaves the element I'd like it to return the elements to their initial "z-index", which I suppose I do using either insertBefore() or insertAfter(). But how do I know where to reinsert the elements? And is there a method I can use on the set() which will do this for all its elements, or do I need to write acustom method?
On a related note, I'm storing the set as a property of a javascript object
this.marker = this.canvas.set()
But this.marker isn't showing up at all in firebug, despite attr changes triggered by the hover (and dependant on finding .marker via the parent object) happening consistently. Does anyone knwo why this.marker isn't showing up in the dom?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
跟踪 z-index。 zindex++ 适用于您创建的每个 raphäel。然后保存您在索引层次结构中移动的对象的原始 z 索引。
也可以在集合上尝试 insertBefore() 。应该有效。我将大量的对象放在一个集合中,并且必须同时移动它们(http://www.ichbinadrian.ch)并且 set.translate() 对我来说工作得很好。
Keep track off the z-index. zindex++ for every raphäel you create. Then save the original z-index for the object you move around in the index-hierarchy.
Also try insertBefore() on the set. Should work. I kept a huge amount of objects in a set and had to move them all around at the same time (http://www.ichbinadrian.ch) and set.translate() worked fine with me.