How to change the color of an SVG image on hover?

Possible duplicate:
Changing the color of an SVG image using javascript

I want to change the fill of an SVG image when I hover over it.

Now I have a black question mark exported from Illustrator to SVG. I can put on my page with the img tag and it displays fine, however I have no idea how to change the color in the code.

+5
source share
3 answers

SVG files can be modified directly from javascript, that is, the "image" properties are accessible from the DOM.

Take a look at this post from: change the stroke and fill the SVG image using JavaScript

, svg HTML <img/>, <svg>... </svg>, .

: SVG w3schools

w3schools, svg

+1

hover- svg, <img> . svg <iframe> , <object> <embed> . HTTP- GET, svg- inline html-.

, svg ( , ). , CSS: hover .

svg .

+7

, , .

: http://tutorials.jenkov.com/svg/svg-and-css.html

( SVG) :

<img src="image1.svg"
onmouseover="this.src='image2.svg'"
onmouseout="this.src='image1.svg'">

Live demo: http://jsfiddle.net/JNChw/

-3

All Articles