在 SVG 中为一个'set'元素设置多个'begin'属性



我目前正在创建一个交互式SVG世界地图,左边是世界语言列表,右边是地图。当用户在语言名称上悬停时,使用该语言的国家/地区会更改其填充值。在我到达印度之前,这一切都很好,在那里我会说旁遮普语、古吉拉特语和印地语。基本代码是这样工作的:

<g id="RussianL">
<path id="russia" d="blah blah blah" />
<set attributeName="fill" to="#CC3232" begin="Russian.mouseover" end="Russian.mouseout" />
</g>

其中"Russian"是一个文本对象,对应于左侧菜单上的单词"Russian"。我可以用同样的策略来代表印度的语言吗(其中3种需要出现在地图上)?我试着只添加了三个"begin"属性,但结果都不起作用(至少在我最新的Chrome和Firefox中)。

那么,有没有一种方法可以用内联代码做到这一点,或者我需要使用javascript/jquery,或者我只是使用了错误的文件类型来实现我希望实现的目标?

谢谢!

您需要多个集合元素,每个元素都有自己的开始/结束。

<set attributeName="fill" to="blue" begin="Punjabi.mouseover" end="Punjabi.mouseout" />
<set attributeName="fill" to="orange" begin="Gujarati.mouseover" end="Gujarati.mouseout" />
<set attributeName="fill" to="pink" begin="Hindi.mouseover" end="Hindi.mouseout" />

最新更新