How to scale div containing SVG?

I've got a <div> 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.

Upvotes: 4

Views: 5290

Answers (1)

Matt Oates
Matt Oates

Reputation: 155

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.

Upvotes: 1

Related Questions