如何使SVG中的g元素可点击 [英] How to make a g element in an SVG clickable
本文介绍了如何使SVG中的g元素可点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道这是进行转换的分组.我也浏览了文档,却没有发现任何相关信息,但想知道是否有可能.
I understand that it is a grouping for transformations. I have also looked through the documentation and have found nothing regarding this, but was wondering whether it is possible.
推荐答案
为元素和侦听器分配ID. 例
Assign id to element, and listener. Ex.
<g id="clickg"><circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="red"/><g>
$("#clickg").on("click",function () {
alert("click");
});
这篇关于如何使SVG中的g元素可点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文