4

All of the examples on jQuery SVG's website seem to be geared toward building an SVG object in javascript and building new elements within it. It doesn't talk much about manipulating existing markup.

PROBLEM:

I have an existing SVG object with events wired up to javascript functions. I want to take the event target (in this case, an SVG Path element) and .animate() it using jQuery SVG.

However, simply $(myElement).animate() doesn't seem to work. The issue at hand seems to be that $(myElement) doesn't accept SVG objet arguments, or something.

Oddly the animate completion callback seems to work, but NO animation type I try to do with it works at all.

I'm not convinced it's properly recognizing the event target as an SVG <path>.

Even directly manipulating the attributes of the path don't seem to work (using .attr())

I know factually that myElement is a valid SVG path because if I use basic JS DOM techniques like changing the class with .setAttribute(), it works fine.

Phrogz
  • 296,393
  • 112
  • 651
  • 745
M. Ryan
  • 6,973
  • 11
  • 52
  • 76

1 Answers1

1

Probably this one could help you out: http://keith-wood.name/svgRef.html#support Just an example taken from this page: $(shape).animate({svgFill: 'lightblue'}, 2000);

Matthias
  • 1,386
  • 3
  • 24
  • 59