Index: static/js/navbar.js |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/static/js/navbar.js |
@@ -0,0 +1,35 @@ |
+/******************************************************************************* |
+ * Navbar Component |
juliandoucette
2017/10/31 15:18:37
Are you planning to add accessibility features lik
ire
2017/11/02 11:15:25
I haven't done much research either, but I would p
|
+ ******************************************************************************/ |
+(function() |
juliandoucette
2017/10/31 15:18:37
TOL: I'm not sure that we have to worry about poll
ire
2017/11/02 11:15:26
You're probably right. I'll remove it.
ire
2017/11/02 11:15:26
Done.
|
+{ |
+ document.addEventListener("DOMContentLoaded", function() |
+ { |
+ |
+ function Navbar(navbar) |
+ { |
+ this.navbar = navbar; |
+ |
+ this.navbar |
+ .querySelector(".toggle-navbar-collapse") |
+ .addEventListener("click", this._onClick.bind(this), false); |
+ } |
+ |
+ Navbar.prototype.toggleCollapse = function() |
+ { |
+ this.navbar.classList.toggle("expanded"); |
+ }; |
+ |
+ Navbar.prototype._onClick = function() |
+ { |
+ this.toggleCollapse(); |
+ }; |
+ |
+ var navbars = document.getElementsByClassName("navbar"); |
+ for (var i = 0; i < navbars.length; i++) |
+ { |
+ new Navbar(navbars[i]); |
+ } |
+ |
+ }, false); |
+}()); |