隐藏asp:图像SVG元素 [英] Hide asp:Image SVG elements
本文介绍了隐藏asp:图像SVG元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个复杂的SVG
,但是出于演示目的,我将使用仅包含两个组的一个.
I have a complex SVG
, but for demonstration purpose I will use one which contains only two groups.
<svg id="sv" viewBox="0 0 150 150" xmlns="http://www.w3.org/2000/svg">
<g id="gr1" fill="white" stroke="green" stroke-width="5">
<circle cx="40" cy="40" r="25" />
<circle cx="60" cy="60" r="25" />
</g>
<g id="gr2" fill="white" stroke="green" stroke-width="5">
<circle cx="90" cy="60" r="25" />
<circle cx="96" cy="40" r="25" />
</g>
</svg>
此SVG在asp:Image
中这样调用:
This SVG is called in an asp:Image
like this:
<asp:Image ID="img" runat="server" Visible="true" Style="align-content: center;" ImageUrl="~/Img/circle.svg" />
我从此问题中知道如何隐藏元素从我的SVG中获取.
I know from this question how could I hide an element from my SVG.
我的问题是,如何隐藏asp:Image
中调用的svg中的gr2?
My question is how could I hide, for example, gr2 from the svg which is called in the asp:Image
?
推荐答案
检查一下:
<asp:ImageButton ID="Image1" OnClientClick="test()" runat="server" ImageUrl="~/Img/PumpStation/circle.svg" />
<script>
function test() { $('#svgimageid').find('#gr1').css('visibility','hidden') });
</script>
这篇关于隐藏asp:图像SVG元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文