|
Show and hide elements
To show and hide the stamp backdrop, mouse on and off the stamp. To change the color of the hidden element, click on the stamp. |
To create the above rollover, download the zip files or hqx files, then do the following:
Name the solid red stamp element backdrop. Be sure to name the element and not the layer.
Select all of the stamp elements and group them. DO NOT include the "backdrop" element in this group.
Make sure the above group is selected.
Using the "Windows" menu, show the SVG Interactivity Palette.
Using the SVG Interactivity Palette, link in the events.js file.
- Click on the folder icon.
- Click on the "Add" button to source in a JavaScript file.
- In the "URL" text field, type events.js . Note: If the events.js file will not be located in the same directory as the SVG file, add the relative path of the events.js file.
- Click the "OK" button and then click the "Done" button.
Using the SVG Interactivity Palette, add the mouse events.
- Select "onmouseover" from the "Event" drop-down menu.
- In the "JavaScript" text field, type elemShow(evt, 'backdrop') and press <Enter>.
- Select "onmouseout" from the "Event" drop-down menu.
- In the "JavaScript" text field, type elemHide(evt, 'backdrop') and press <Enter>.
- Select "onclick" from the "Event" drop-down menu.
- In the "JavaScript" text field, type elemColor(evt, 'backdrop', '#336699') and press <Enter>.
Create a new layer and on that layer, draw a rectangle or path, with no stroke and no fill, around the "backdrop" element. This invisible but non-hidden boundary will ensure the viewable area of the SVG is large enough to display the hidden backdrop when it is made visible.
Hide the "backdrop" element. DO NOT hide the layer.
Using the default settings, export the file as SVG and name it show_hide.svg.
Copy a version of Samples/SVG_Iteractivity_Palette/mouse_events/events.js into the same directory as the SVG file or to the relative location you specified earlier.
Embed SVG within an HTML document by adding the following to the <BODY> of your HTML:
<EMBED SRC="show_hide.svg" TYPE="image/svg-xml" PLUGINSPAGE="http://www.adobe.com/svg/viewer/install/" HEIGHT="191" WIDTH="157">
This presumes that the SVG file is in the same directory as the HTML and that the height and width correspond with those of the SVG file.