Edit markup for the svg tag

217 views
Skip to first unread message

Andy Beer

unread,
Jun 18, 2014, 8:45:54 AM6/18/14
to joi...@googlegroups.com
Hello, 

I would like to make my svg responsive and need to update the <svg> tag with the following additional markup: 

preserveAspectRatio="xMinYMin meet" 
viewBox="0 0 500 500"

Is there a simple way to add this additional markup. Apologies if this is obvious or has been covered in another post but I have been looking at this for a good few days and I can't find anyone that has done this.

Thanks


Andy

David Durman

unread,
Jun 18, 2014, 8:53:10 AM6/18/14
to joi...@googlegroups.com
V(paper.svg).attr({ preserveAspectRatio: "xMinYMin meet", viewBox: "0 0 500 500" })

paper.svg points to the <SVG> document element. Here I'm using Vectorizer (http://jointjs.com/api#v) to set the attributes. Vectorizer makes sure attributes are set using the correct namespace.

---

David Durman
client IO


--

---
You received this message because you are subscribed to the Google Groups "JointJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jointjs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Andy Beer

unread,
Jun 18, 2014, 9:06:48 AM6/18/14
to joi...@googlegroups.com
Dave, 

Thanks so much for a very fast response to my question! Exactly the solution I was looking for :)

Thanks for the help and guidance and pointing me to the correct section of the API docs.


Andy
Reply all
Reply to author
Forward
0 new messages