本文介绍了动态添加时,SVG元素不会动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用jQuery为其动画添加动态DOM时尝试实现SVG元素的动画。
我使用JS生成DOM,因此HTML页面没有此动画的任何元素。
当我动态添加它时,动画将无法在Chrome(16)中启动,但它可以与FF(8)一起使用

I have trying to achieve SVG element's animation while adding dynamic DOMs for its animation with jQuery.I generate DOMs with JS, so HTML page does not have any elements for this animation.When I add it dynamically, animation will not start in Chrome(16), however it works with FF(8)

动画完美是我删除用JS生成的动态doms并将它们静态放入HTML页面。

The animation would perfect is I remove that dynamic doms which are generated with JS and put them static into HTML page.

我为它创建了小提琴:

I have created fiddle for it at : http://jsfiddle.net/cjP6K/7/

我放了一个svg dom static进入HTML页面,然后我用文件准备好的jQuery克隆了那个元素,
在这个场景中,后来用JS添加的那个将不会Animate完全!!(这适用于FF)

where I have put one svg dom static into HTML page, then I have cloned that element with jQuery on document ready,In this scene, the one which was added later with JS will not Animate at all !!(this works with FF)

请帮助......

谢谢,
Chetan。

Thanks,Chetan.

推荐答案

animateMotion标签中有一个chrome bug,它已经存在多年的问题..

There is a chrome bug in the animateMotion tag, it has been an issue for ages..

参考

在维持svg dom的同时,用铬来解决这个问题并不多。

There isn't much that can be done to get around it in chrome while still maintaining an svg dom..

希望这会有所帮助..

Hope this helps..

这篇关于动态添加时,SVG元素不会动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 18:55