Log in

Julien Goodwin
A (small) answer to Rusty's "SVG Presentation Pain" 
28th-Dec-2006 07:15 pm
See Rusty, less then 2 1/2 hours later and here's a (semi-) working prototype. Due to the way inkscape renames layers this isn't perfect, but dump the attached HTML behind the lj-cut in the directory with the file and open it in FireFox or Opera and use the left and right angle bracket buttons to switch layers.

Apologes if this bit hits the planet, don't know how cut's in livejournal are handled by planet.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
	<title>SVG Layer test</title>
<SCRIPT type="text/javascript">
var curslide = 1;

function toggle_layer(bool, element_name) {
	//get a reference to the svg document and then to a group with the given id 
	var svgobj = document.embeds['talk'].getSVGDocument().getElementById(element_name);
	if (!bool){
		// Hide layer.
		alert(element_name + " hidden");
	} else {
		// Show layer.
		alert(element_name + " shown");
<embed width="800" height="600" src="virtualization-talk.svg" name="talk" type="image/svg+xml">
<form name="SVGcontrols" action="">
<table><tr><td align="left"><input type="button" value="<"  onclick="toggle_layer(0,'layer' + curslide);toggle_layer(1,'layer' + --curslide)"></td>
<td align="right"><input type="button" value=">" onclick="toggle_layer(0,'layer' + curslide);toggle_layer(1,'layer' + ++curslide)"></td></tr></table>
This page was loaded Feb 20th 2017, 6:08 am GMT.