Browse Source

Add javascript to open table of contents on click.

* preamble.html: Add javascript so the table of contents can be open
  with a click as well as mouse-over (for tablets.)
Rick Frankel 6 years ago
parent
commit
2b8d18b41f
1 changed files with 6 additions and 0 deletions
  1. 6 0
      preamble.html

+ 6 - 0
preamble.html

@@ -10,4 +10,10 @@
     var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
   })();
 
+  document.addEventListener('DOMContentLoaded',function() {
+      document.getElementById("table-of-contents").onclick = function() {
+          var elem = document.getElementById("text-table-of-contents");
+          elem.style.display = elem.style.display == "block" ? "none" : "block";
+      }
+  });
 </script>