fabricio
fabricio

Reputation: 1393

Can't make SVG animation work with ie9 and firefox

I don't know what I am missing. SVG animation shows ok in chrome, but although i see the image in ie9 and firefox, i can't see the animation.

I have exported svg file from Corel Draw x5:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"        "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Creator: CorelDRAW -->
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="100%" height="100%" style="shape-rendering:geometricPrecision; text-rendering:geometricPrecision; image-rendering:optimizeQuality; fill-rule:evenodd; clip-rule:evenodd"
viewBox="0 0 25.4 2.64582"
 xmlns:xlink="http://www.w3.org/1999/xlink">
 <defs>
  <style type="text/css">
   <![CDATA[
    .str0 {stroke:#898989;stroke-width:0.05}
    .fil0 {fill:none}
   ]]>
  </style>
 </defs>
 <g id="Capa_x0020_1">
    <path class="fil0 str0" d="M0.10261 2.04656c0.08134,0 0.25217...
    />

and then i added the animation:

<path class="fil0 str0" d="M0.10261 2.04656c0.08134,0 0.25217...
    stroke-dasharray="">
  <animate id="first" attributeName="stroke-dashoffset" from="" to="0" dur="10s" begin="0s"
  onload="var length = parentNode.getTotalLength();
                   parentNode.setAttribute('stroke-dasharray',length+','+length);
                   this.setAttribute('from',length)" />
  </path>

Code can be seen in jsfiddle http://jsfiddle.net/calamar888/WsxHs/

Thanks so much!

PS 1: Have to say i've already looked for an answer but i couldn't find anything that solve my problem so far.

PS 2: Firebug console does not show anything

Upvotes: 1

Views: 2491

Answers (1)

Robert Longson
Robert Longson

Reputation: 124029

IE9 does not support animation and Firefox only fires onload events on <svg> elements so you'll have to move the onload code work off the root <svg> element.

Upvotes: 5

Related Questions