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

github.com/hossainemruz/toha.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralex bezek <alex.bezek@cerner.com>2020-10-31 18:35:23 +0300
committerGitHub <noreply@github.com>2020-10-31 18:35:23 +0300
commitbeb9d55b9599dd751149003ba36acf6262a79270 (patch)
tree4a390ff784bb31b162e23025053422c57ddcdc63
parent9ac57313ffcea6f7159f775e886f0f29dc434274 (diff)
Fix the nav item collapse and spy functionality (#138)
-rw-r--r--layouts/partials/navigators/navbar.html21
-rw-r--r--static/assets/js/navbar.js9
2 files changed, 11 insertions, 19 deletions
diff --git a/layouts/partials/navigators/navbar.html b/layouts/partials/navigators/navbar.html
index 03f68c0..f936796 100644
--- a/layouts/partials/navigators/navbar.html
+++ b/layouts/partials/navigators/navbar.html
@@ -31,16 +31,7 @@
<div class="collapse navbar-collapse" id="top-nav-items">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
- <a
- class="nav-link"
- href="#home"
- data-toggle="collapse"
- data-target=".navbar-collapse"
- aria-controls="collapseExample"
- role="button"
- >
- {{ i18n "home" }}
- </a>
+ <a class="nav-link" href="#home">{{ i18n "home" }}</a>
</li>
{{ if $sections }}
{{ range sort $sections "section.weight" }}
@@ -50,15 +41,7 @@
{{ $sectionID = .section.id }}
{{ end }}
<li class="nav-item">
- <a
- class="nav-link"
- href="#{{ $sectionID }}"
- data-toggle="collapse"
- data-target=".navbar-collapse"
- aria-controls="collapseExample"
- >
- {{ .section.name }}
- </a>
+ <a class="nav-link" href="#{{ $sectionID }}">{{ .section.name }}</a>
</li>
{{ end }}
{{- end }}
diff --git a/static/assets/js/navbar.js b/static/assets/js/navbar.js
index c882cc6..929c74b 100644
--- a/static/assets/js/navbar.js
+++ b/static/assets/js/navbar.js
@@ -30,6 +30,15 @@
$('#logo').attr("src", invertedLogo);
}
});
+
+ // Creates a click handler to collapse the navigation when
+ // anchors in the mobile nav pop up are clicked
+ var navMain = $(".navbar-collapse");
+ if (navMain) {
+ navMain.on("click", "a", null, function (e) {
+ $('.navbar-collapse').collapse('hide');
+ });
+ }
});
})(jQuery);