当前位置: 动力学知识库 > 问答 > 编程问答 >

javascript - How to find the size of an SVG element across browsers

问题描述:

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?

Demo on jsBin

网友答案:

You could try to wrap a div around it:

Running Demo

分享给朋友:
您可能感兴趣的文章:
随机阅读: