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.
精彩评论