jquery-svg

SVG foreignObject not showing in Chrome

北城余情 提交于 2019-12-04 19:22:08
问题 I have an SVG element with a foreignObject which contains a div. Then in my js I do this: $("#wrapper>svg>foreignObject>div").sparkline(data); which creates a canvas within the div. When I look at the firebug html code for the two browser are: Firefox: <svg> <foreignObject width="20" height="20" x="10" y="-10"> <div> <canvas style="display: inline-block; width: 18px; height: 19px; vertical-align: top;" width="18" height="19"></canvas> </div> </foreignObject> </svg> Chrome: <svg>

how to scale the element by keeping the fixed position in svg

我怕爱的太早我们不能终老 提交于 2019-12-03 13:56:13
问题 i want to scale the below element in fixed position. <path id="container_svg_rectsymbol1" fill="red" stroke-width="1" stroke="Gray" d="M 73.1111111111111 -71.75 L 83.1111111111111 -71.75 L 83.1111111111111 -61.75 L 73.1111111111111 -61.75 L 73.1111111111111 -71.75" transform="scale(1)"/> when am start scaling it moves from one location to another location. i don't want to move the object i just want to enlarge the size of object. i have referred following link. http://commons.oreilly.com/wiki

SVG foreignObject not showing in Chrome

孤者浪人 提交于 2019-12-03 13:05:12
I have an SVG element with a foreignObject which contains a div. Then in my js I do this: $("#wrapper>svg>foreignObject>div").sparkline(data); which creates a canvas within the div. When I look at the firebug html code for the two browser are: Firefox: <svg> <foreignObject width="20" height="20" x="10" y="-10"> <div> <canvas style="display: inline-block; width: 18px; height: 19px; vertical-align: top;" width="18" height="19"></canvas> </div> </foreignObject> </svg> Chrome: <svg> <foreignobject width="20" height="20" x="10" y="-10"/> <svg> In chrome it doesnt even show the div. The way I create

how to scale the element by keeping the fixed position in svg

佐手、 提交于 2019-12-03 00:14:51
i want to scale the below element in fixed position. <path id="container_svg_rectsymbol1" fill="red" stroke-width="1" stroke="Gray" d="M 73.1111111111111 -71.75 L 83.1111111111111 -71.75 L 83.1111111111111 -61.75 L 73.1111111111111 -61.75 L 73.1111111111111 -71.75" transform="scale(1)"/> when am start scaling it moves from one location to another location. i don't want to move the object i just want to enlarge the size of object. i have referred following link. http://commons.oreilly.com/wiki/index.php/SVG_Essentials/Transforming_the_Coordinate_System how to do fixed scaling ? i want to

JQuery and SVG - how to find the 'g' tag

…衆ロ難τιáo~ 提交于 2019-12-01 04:46:51
Imagine this: <svg> <g id="node1" class="node"></g> <g id="node2" class="node"></g> </svg> How can I find the 'g' tag, I want that all tags could be clicked, and not just 'node1' or 'node2'. I've tried simular to this, but could not get it work. $('g').click(function(){ alert("Hellooooo"); }); Use find() method for more info visit this For eg $("body").find("p").css("background-color","#f00"); sets all body's <p> element background-color to red. For your question try this: $("svg").find("g").click(function(){ // your jquery code here } ); Thanks to C-Link I've solved this. To be sure only the

jquery animate for element attributes not style

旧街凉风 提交于 2019-12-01 03:19:54
ASAIK jquery animate function accepts style properties only. but i want to animate the attributes of an element. consider a SVG element rectangle <svg> <rect id="rect1" x=10 y=20 width="100px" height="100px"> </svg> i want to animate the rectangle element attribute "x" and "y" something like below $("#rect1").animate({ x: 30, y: 40 }, 1500 ); but it is not correct way because animate function affects style not attribute of an element. i knew so many custom plugin is there like raphel.js . http://raphaeljs.com/ but i don't want to use custom plugin to do this. i want to do this simply in jquery

JQuery and SVG - how to find the 'g' tag

99封情书 提交于 2019-12-01 01:27:56
问题 Imagine this: <svg> <g id="node1" class="node"></g> <g id="node2" class="node"></g> </svg> How can I find the 'g' tag, I want that all tags could be clicked, and not just 'node1' or 'node2'. I've tried simular to this, but could not get it work. $('g').click(function(){ alert("Hellooooo"); }); 回答1: Use find() method for more info visit this For eg $("body").find("p").css("background-color","#f00"); sets all body's <p> element background-color to red. For your question try this: $("svg").find(

Create a map with clickable provinces/states using SVG, HTML/CSS, ImageMap

时光毁灭记忆、已成空白 提交于 2019-11-29 20:48:47
I am trying to create an interactive map where users can click on different provinces in the map to get info specific to that province. Example: http://www.todospelaeducacao.org.br/ http://code.google.com/p/svg2imap/ So far I've only found solutions that have limited functionality. I've only really searched for this using an SVG file, but I would be open to other file types if it is possible. If anyone knows of a fully functioning way to do this (jQuery plug-in, PHP script, vector images) or a tutorial on how to do it manually please do share. jQuery plugin for decorating image maps

jQuery animate SVG element

泄露秘密 提交于 2019-11-29 09:57:29
I got a svg in my application. Like <svg id="gt" height="450" width="300" xmlns="http://www.w3.org/2000/svg"> <image id="1_dice" x="0" y="420" height="30" width="30" xlink:href="images/1_coin.png" /> </svg> I got a svg element named '1_dice'. In a HTML button click I would likes to animate the element according to the parameters. Like $('#btn').click(function(){ $('#1_dice').animate({'x':200},2000); }); I tried this but this doesn't working ... jQuery animate is for animating HTML elements. For SVG you have to try jQuery SVG plugin. Please follow the link - http://keith-wood.name/svg.html It

How to place text in the center of an svg path

喜欢而已 提交于 2019-11-29 04:27:55
For rendering SVG I'm using jQuery SVG plugin. And, now I want to add text to each path and polygon. On jsFiddle you can see generated markup by plugin. For creating text I wrote the following code: var svgg = $("#rsr").svg('get'); var texts = svgg.createText(); svgg.textpath($("#Layer_x0020_1"),id, texts.string('We go '). span('up', { dy: -30, fill: 'red' }).span(',', { dy: 30 }). string(' then we go down, then up again')); In the code on jsFiddle you can see that the textpath tag exists, but it's not visible. How to add text to the center of each path? Thanks. To place text in a straight