How to scale div containing SVG?

I have a <div> element on a page with SVG. Sometimes during program execution, the size and position of the containing div changes. Unfortunately, SVG follows the Div, but does not scale with it. How can I get SVG bigger or smaller when resizing the containing element?

I use the Raphael library to create SVG and jQuery for events and DOM manipulations.

+4
source share
1 answer

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

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

+1
source

All Articles