Left: | ||
Right: |
LEFT | RIGHT |
---|---|
1 (function(){ | 1 (function(){ |
2 document.addEventListener("DOMContentLoaded", function() | 2 document.addEventListener("DOMContentLoaded", function() |
3 { | 3 { |
4 | 4 |
5 // Change html class name from "no-js" to "js" | 5 // Change html class name from "no-js" to "js" |
6 document.documentElement.className = "js"; | 6 document.documentElement.className = "js"; |
7 | 7 |
8 document | 8 // Toggle Navbar Collapse |
juliandoucette
2017/08/23 14:39:04
If you agree with my comments elsewhere then I thi
ire
2017/08/25 08:27:07
Done.
| |
9 .getElementById("toggle-search-form") | 9 function toggleNavbarCollapse() |
10 .addEventListener("click", function(e) { | 10 { |
11 e.preventDefault(); | 11 var navbarCollapseEls = this.parentElement.getElementsByClassName("navbar- collapse"); |
12 document | 12 for (var i = 0; i < navbarCollapseEls.length; i++) |
13 .getElementById("site-search") | 13 { |
14 .classList.toggle("open"); | 14 navbarCollapseEls[i] |
15 }, false); | 15 .classList.toggle("open") |
16 } | |
17 } | |
18 | |
19 var toggleNavbarCollapseEls = document.getElementsByClassName("toggle-navbar -collapse"); | |
20 for (var i = 0; i < toggleNavbarCollapseEls.length; i++) | |
21 { | |
22 toggleNavbarCollapseEls[i] | |
23 .addEventListener("click", toggleNavbarCollapse, false); | |
24 } | |
16 | 25 |
17 }, false); | 26 }, false); |
18 }()); | 27 }()); |
LEFT | RIGHT |