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: Change mobile to tablet-breakpoint, add polyfill for classList, re-order rtl styles Created Sept. 1, 2017, 10:53 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
« no previous file with comments | « static/img/svg/search-icon.svg ('k') | static/js/vendor/classList.min.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+}());
« no previous file with comments | « static/img/svg/search-icon.svg ('k') | static/js/vendor/classList.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld