jQuery动画SVG元素
问题描述:
我的应用程序中出现了svg.喜欢
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>
我得到了一个名为'1_dice'的svg元素.在HTML按钮中,单击我想根据参数对元素进行动画处理".喜欢
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用于动画HTML元素. 对于SVG,您必须尝试 jQuery SVG 插件. 请点击链接- http://keith-wood.name/svg.html
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