O'Reilly logo

Designing SVG Web Graphics by Andrew H. Watt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

SVG Events

SVG provides an extensive range of events, which are listed in Chapter 16 of the SVG specification at http://www.w3.org/TR/SVG/. The most useful events are the click, mouseover, and mouseout events. You can also use the mousedown and mouseup events, but I find that I rarely use them.

Listing 11.1 shows the syntax for using a click event to begin an animation that uses a <set> element.

Listing 11.1. (BasicEvents01.svg)
 <?xml version="1.0" standalone="no"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/PR-SVG-20010719/ DTD/svg10.dtd"> <svg> <defs> <linearGradient id="MyGreenGradient"> <stop offset="5%" style="stop-color:#006600"/> <stop offset="95%" style="stop-color:#99FFCC"/> </linearGradient> </defs> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required