Index: static/js/main.js |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/static/js/main.js |
@@ -0,0 +1,27 @@ |
+(function(){ |
+ document.addEventListener("DOMContentLoaded", function() |
juliandoucette
2017/08/29 16:17:29
NIT: We can support this in IE8 via https://github
ire
2017/09/01 10:57:22
This was already added, but I had an incorrect fil
|
+ { |
+ |
+ // Change html class name from "no-js" to "js" |
+ document.documentElement.className = "js"; |
+ |
+ // Toggle Navbar Collapse |
+ function toggleNavbarCollapse() |
+ { |
+ var navbarCollapseEls = this.parentElement.getElementsByClassName("navbar-collapse"); |
+ for (var i = 0; i < navbarCollapseEls.length; i++) |
+ { |
+ navbarCollapseEls[i] |
+ .classList.toggle("open") |
juliandoucette
2017/08/29 16:17:29
NIT: We can support this in IE < 10 via https://gi
ire
2017/09/01 10:57:21
Done.
|
+ } |
+ } |
+ |
+ var toggleNavbarCollapseEls = document.getElementsByClassName("toggle-navbar-collapse"); |
+ for (var i = 0; i < toggleNavbarCollapseEls.length; i++) |
+ { |
+ toggleNavbarCollapseEls[i] |
+ .addEventListener("click", toggleNavbarCollapse, false); |
+ } |
+ |
+ }, false); |
+}()); |