Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zzossig/hugo-theme-zdoc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'layouts/partials/head/scripts.html')
-rw-r--r--layouts/partials/head/scripts.html20
1 files changed, 20 insertions, 0 deletions
diff --git a/layouts/partials/head/scripts.html b/layouts/partials/head/scripts.html
index d040c9e..c63b17a 100644
--- a/layouts/partials/head/scripts.html
+++ b/layouts/partials/head/scripts.html
@@ -13,6 +13,26 @@
"use strict";
window.onload = function() {
+ // ===================== navbar collapse ======================
+ var navCollapseBtn = document.getElementById('navCollapseBtn');
+ navCollapseBtn ? navCollapseBtn.addEventListener('click', function(e) {
+ var navCollapse = document.querySelector('.navbar__collapse');
+
+ if (navCollapse) {
+ var dataOpen = navCollapse.getAttribute('data-open');
+
+ if (dataOpen === 'true') {
+ navCollapse.setAttribute('data-open', 'false');
+ navCollapse.style.maxHeight = 0;
+ } else {
+ navCollapse.setAttribute('data-open', 'true');
+ navCollapse.style.maxHeight = navCollapse.scrollHeight + "px";
+ }
+ }
+ }) : null;
+ // ============================================================
+
+
// ========================== expand ==========================
var expandBtn = document.querySelectorAll('.expand__button');