如何在不同浏览器中查找SVG元素的大小 [英] How to find the size of an SVG element across browsers
本文介绍了如何在不同浏览器中查找SVG元素的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图获取视口中的元素的大小。为此,我使用了 getClientBoundingRect()
,因为它将给我应用变换后的大小。我遇到的问题是,客户端rect不会大于最大的视口。所以我切换到 getBBox()
。现在的问题是,它不工作在Firefox。在所有浏览器中获取元素大小的最佳方法是什么?
I am trying to get the size of an element inside of a viewport. For this I have used getClientBoundingRect()
because it will give me the size after transforms have been applied. The issue I have ran into is that the client rect will not size bigger than the highest viewport. So I switched to getBBox()
. Now the problem is that it does not work in Firefox. What is the best way to get the size of an element across all the browsers?
推荐答案
这篇关于如何在不同浏览器中查找SVG元素的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文