Implement basic navbar

Signed-off-by: Tobias Eidelpes <tobias@eidelpes.info>
This commit is contained in:
2020-04-07 13:51:05 +02:00
parent e769fffed7
commit c8bc0ca1cd
8 changed files with 126 additions and 1 deletions
+1
View File
@@ -8,6 +8,7 @@ require("turbolinks").start()
require("@rails/activestorage").start()
require("channels")
require("packs/custom");
// Uncomment to copy all static images under ../images to the output folder and reference
// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)
+14
View File
@@ -0,0 +1,14 @@
/* Toggle between adding and removing the "responsive" class to topnav when the user clicks on the icon */
function toggleMenu() {
var x = document.getElementById("topnav");
if (x.className === "topnav") {
x.className += " responsive";
} else {
x.className = "topnav";
}
}
/* First load all other scripts and then listen for click on menu */
document.addEventListener('turbolinks:load', () => {
document.getElementById("toggleMenu").addEventListener("click", toggleMenu);
});