开发者

How to scale div containing SVG?

开发者 https://www.devze.com 2023-02-27 08:26 出处:网络
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 alon

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

精彩评论

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