Implement basic navbar
Signed-off-by: Tobias Eidelpes <tobias@eidelpes.info>
This commit is contained in:
@@ -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' %>)
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
Reference in New Issue
Block a user