[gnome-web-www: 37/68] JavaScript code to handle the Foundation menu bar
- From: Tom Tryfonidis <tomtryf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-web-www: 37/68] JavaScript code to handle the Foundation menu bar
- Date: Tue, 24 Jan 2017 15:50:19 +0000 (UTC)
commit 825d1a2cafc44a6cdbfaf635c141b58dc64560a7
Author: Tom Tryfonidis <tomtryf gnome org>
Date: Mon Jan 9 18:05:10 2017 +0200
JavaScript code to handle the Foundation menu bar
theme/js/template.js | 28 +++++++++++++++++++++++++++-
1 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/theme/js/template.js b/theme/js/template.js
index b9611ce..e28fdb5 100644
--- a/theme/js/template.js
+++ b/theme/js/template.js
@@ -12,7 +12,33 @@ jQuery(document).ready(function($) {
$('body').addClass(match[0]);
}
-
+
+ /* Foundation menu
+ * ====================================================================== */
+
+ // Don't let Bootstrap handle the dropdown menu
+ $('#menu-primary .dropdown-toggle').removeAttr('data-toggle');
+
+ $('#menu-primary .dropdown-toggle').on('click', function(e) {
+
+ $('#menu-primary .dropdown').toggleClass('open');
+ $('html').toggleClass('menu-open');
+
+ if ($('#menu-primary .dropdown-menu').is(":visible")) {
+ $('.navbar').append('<span class="nav-bg"></span>');
+ } else {
+ $('span.nav-bg').remove();
+ }
+ // Don't jump at the top of the page
+ e.preventDefault()
+ return false;
+ });
+
+ // Trigger click to keep the menu open on Foundation page
+ if( $('.foundation-menu-item').hasClass('current-menu-parent') ) {
+ $('#menu-primary .dropdown-toggle').trigger('click');
+ }
+
/* Global search placeholder
* ====================================================================== */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]