开发者

How to scale div containing SVG?

I've got a <div&开发者_如何学运维gt; element on page with SVG in it. Sometimes during program execution the size and position of containing div changes. SVG follows the div but doesn't scale along with it, unfortunately. How can I get SVG bigger or smaller when the size of containing element changes?

I use Raphael library for SVG creation and jQuery for events and DOM manipulation.


You can use setViewBox() http://raphaeljs.com/reference.html#Paper.setViewBox

However, if you use this for scaling there will no longer be a 1:1 unit:pixel scale.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜