Choosing to control an existing item using jQuery SVG

All the examples on the jQuery SVG website seem to be aimed at creating an SVG object in javascript and creating new elements in it. He does not talk about how to manipulate existing markup.

Problem:

I have an existing SVG object with events connected to javascript functions. I want to accept the purpose of the event (in this case, the SVG Path element) and .animate() use jQuery SVG.

However, just $(myElement).animate() doesn't seem to work. The problem is that $(myElement) does not accept SVG objet arguments or something like that.

Oddly enough, the animation completion callback seems to work, but the NO type of animation I'm trying to work with generally works.

I'm not sure if it correctly recognizes the event target as an SVG <path> .

Even direct management of path attributes does not work (using .attr() )

I know that myElement is a valid SVG path, because if I use basic JS DOM methods such as modifying a class using .setAttribute() , it works fine.

+4
source share
1 answer

This can probably help you: http://keith-wood.name/svgRef.html#support Example taken on this page: $ (form) .animate ({svgFill: 'lightblue'}, 2000);

+1
source

Source: https://habr.com/ru/post/1382370/


All Articles