Skip to content

Commit

Permalink
hamburger behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
anxolerd committed Aug 19, 2015
1 parent d77b7b0 commit d011ee6
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions project/static/src/js/hamburger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
(function () {
"use strict";
var nav = document.getElementById('nav-collapsable');
nav.style.maxHeight = "0px";

var toggle_nav = function() {
if (nav.style.maxHeight === "0px") {
nav.style.maxHeight = "400px";
} else {
nav.style.maxHeight = "0px";
}
}

var hamburger = document.getElementById('hamburger');
hamburger.addEventListener("click", function(e) {
e.preventDefault();
if (this.classList.contains("is-active") === true) {
this.classList.remove("is-active");
} else {
this.classList.add("is-active");
}
toggle_nav();
});
})();

0 comments on commit d011ee6

Please sign in to comment.