| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /******************************************************************************* | |
| 2 * 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
| |
| 3 ******************************************************************************/ | |
| 4 (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.
| |
| 5 { | |
| 6 document.addEventListener("DOMContentLoaded", function() | |
| 7 { | |
| 8 | |
| 9 function Navbar(navbar) | |
| 10 { | |
| 11 this.navbar = navbar; | |
| 12 | |
| 13 this.navbar | |
| 14 .querySelector(".toggle-navbar-collapse") | |
| 15 .addEventListener("click", this._onClick.bind(this), false); | |
| 16 } | |
| 17 | |
| 18 Navbar.prototype.toggleCollapse = function() | |
| 19 { | |
| 20 this.navbar.classList.toggle("expanded"); | |
| 21 }; | |
| 22 | |
| 23 Navbar.prototype._onClick = function() | |
| 24 { | |
| 25 this.toggleCollapse(); | |
| 26 }; | |
| 27 | |
| 28 var navbars = document.getElementsByClassName("navbar"); | |
| 29 for (var i = 0; i < navbars.length; i++) | |
| 30 { | |
| 31 new Navbar(navbars[i]); | |
| 32 } | |
| 33 | |
| 34 }, false); | |
| 35 }()); | |
| OLD | NEW |