Julien Goodwin
A (small) answer to Rusty's "SVG Presentation Pain" 
28th-Dec-2006 07:15 pm
booney
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">
<html>
<head>
	<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.
		svgobj.setAttributeNS(null,'visibility','hidden');
		alert(element_name + " hidden");
	} else {
		// Show layer.
		svgobj.setAttributeNS(null,'visibility','visible');
		alert(element_name + " shown");
	}
}
-->
</script>
</head>
<body>
<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>
</form>
</body>
</html>
This page was loaded Oct 25th 2014, 9:24 am GMT.