Commit b5bc81ce authored by Colin Shea's avatar Colin Shea

fix the JS to run only when the document is ready

the code was running too early, whoops. svgDoc was null since the SVG
hadn't finished loading yet.
parent 33d9c50e
......@@ -7,10 +7,13 @@ title: Selected projects
<embed id="contrib-graph" src="/calendar.svg" type="image/svg+xml"></embed>
<script>
var svgDoc = document.getElementById("contrib-graph").getSVGDocument();
var styleElement = svgDoc.createElementNS("http://www.w3.org/2000/svg", "style");
styleElement.textContent = "rect:hover { stroke: #000; }";
svgDoc.rootElement.appendChild(styleElement);
// TODO: Add some tooltips to the SVG graph. Somehow.
document.addEventListener('DOMContentLoaded', function(){
var svgDoc = document.getElementById("contrib-graph").getSVGDocument();
var styleElement = svgDoc.createElementNS("http://www.w3.org/2000/svg", "style");
styleElement.textContent = "rect:hover { stroke: #000; }";
svgDoc.rootElement.appendChild(styleElement);
});
</script>
Here are a selection of my coding projects. If you want more of this, be sure
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment