使用JavaScript,我可以更改SVG的Z索引/层< g>元件? [英] With JavaScript, can I change the Z index/layer of an SVG <g> element?

查看:104
本文介绍了使用JavaScript,我可以更改SVG的Z索引/层< g>元件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有几个复合形状(< g> )。我希望能够点击并拖动它们,但是我希望我碰巧在Z顺序中将其拖动到另一个的TOP上,这样如果我将它拖到其他的那个上,那么另一个一个应该是黯然失色。

Let's say I have a couple composite shapes (<g>). I want to be able to click and drag them, but I want the one I happen to be dragging at the moment to be on TOP of the other one in the Z order, so that if I drag it over the OTHER one, the other one should be eclipsed.

推荐答案

SVG中的Z索引是由元素在文档中出现的顺序定义的。如果要将特定形状置于顶部,则必须更改元素顺序。

Z index in SVG is defined by the order the elements appear in the document. You will have to change the element order if you want to bring a specific shape to the top.

这篇关于使用JavaScript,我可以更改SVG的Z索引/层&lt; g&gt;元件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆