From 098b88b8141ef4e2dbad4eb63035919a0a8af80b Mon Sep 17 00:00:00 2001 From: Darshan Baral Date: Tue, 9 Jul 2019 21:27:08 -0700 Subject: Changed menu behaviour for small screens --- layouts/partials/header.html | 50 ++++++++++++++++++++++---------- layouts/partials/menu/menu_sections.html | 43 +++++++++++++++++++++++++-- static/css/khata.css | 4 --- static/js/khata.js | 31 +------------------- 4 files changed, 76 insertions(+), 52 deletions(-) diff --git a/layouts/partials/header.html b/layouts/partials/header.html index a468577..f0d5014 100644 --- a/layouts/partials/header.html +++ b/layouts/partials/header.html @@ -1,10 +1,7 @@
diff --git a/layouts/partials/menu/menu_sections.html b/layouts/partials/menu/menu_sections.html index 01d86f7..0640f7a 100644 --- a/layouts/partials/menu/menu_sections.html +++ b/layouts/partials/menu/menu_sections.html @@ -6,8 +6,8 @@ {{ else }} + {{ end }} diff --git a/static/css/khata.css b/static/css/khata.css index e00c0ce..16c33a2 100644 --- a/static/css/khata.css +++ b/static/css/khata.css @@ -58,10 +58,6 @@ a, color: white !important; cursor: pointer; } -.hamburger:active { - color: #2f16ac !important; - background-color: white; -} .main-menu { font-variant: small-caps; font-family: "Open Sans", sans-serif; diff --git a/static/js/khata.js b/static/js/khata.js index 6dcba90..8b13789 100644 --- a/static/js/khata.js +++ b/static/js/khata.js @@ -1,30 +1 @@ -let toggleHeight = function(elem) { - if (getComputedStyle(elem)["height"] === "0px") { - elem.style.maxHeight = elem.scrollHeight + 5 +"px"; - } else { - elem.style.maxHeight = "0px"; - } -}; -let toggleDisplay = function(elem) { - elem.classList.toggle("d-none"); -}; -let zeroHeight = function(elem) { - elem.style.maxHeight = "0px"; -}; -let checkClick = function() { - if (!document.querySelector(".dropdown").contains(event.target)) { - zeroHeight(document.querySelector(".dropdown-content")); - } - if ( - window.matchMedia("(max-width: 750px)").matches && - !document.querySelector("nav").contains(event.target) - ) { - document.querySelector(".all-menu").classList.add("d-none"); - } -}; -window.onclick = function() { - checkClick(); -}; -window.ontouchstart = function() { - checkClick(); -}; + -- cgit v1.2.3