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() |
+ { |
+ |
+ // 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") |
+ } |
+ } |
+ |
+ var toggleNavbarCollapseEls = document.getElementsByClassName("toggle-navbar-collapse"); |
+ for (var i = 0; i < toggleNavbarCollapseEls.length; i++) |
+ { |
+ toggleNavbarCollapseEls[i] |
+ .addEventListener("click", toggleNavbarCollapse, false); |
+ } |
+ |
+ }, false); |
+}()); |