Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: static/js/main.js

Issue 29485575: Issue 5385 - Create Site Header Component for Help Center (Closed)
Patch Set: Implement navbar-collapse Created Aug. 25, 2017, 8:25 a.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
+}());

Powered by Google App Engine
This is Rietveld