我一直在玩jQuery动画SVG元素。这适用于Chrome,但不适用于FF或IE。有人可以解释原因吗? :(
www.chriswickham.co.uk/animationstest
随意检查源代码,但这里是左侧动画的代码。
的Javascript
function music(){
$('#mL').animate({cy:'45%'}).animate({cy:'65%'});
$('#mR').animate({cy:'65%'}).animate({cy:'45%'});
}
var musicHands;
$('#music').hover(function(){
music();
musicHands = setInterval(music,750);
},function(){
clearInterval(musicHands);
$('#mL').animate({cy:'55%'});
$('#mR').animate({cy:'55%'});
});
HTML
<div class="section">
<div id="music">
<svg width="100%" height="100%">
<circle cx="50%" cy="30%" r="20%" fill="yellow" />
<circle id="mL" cx="30%" cy="55%" r="8%" fill="red" />
<circle id="mR" cx="70%" cy="55%" r="8%" fill="red" />
<rect y="65%" width="100%" height="25%" fill="black" />
</svg>
</div>
</div>