this.fluidbook = fluidbook;
this._dimensions = this.fluidbook.datas.iconsDimensions;
this._inited = false;
- this.menu = $("#nav");
+ this.menuIsOpen = false;
+ this.menu = $("#menu"); // Renamed from #nav because mmenu animations weren't working (probably due to some other script interference)
this.setNav();
}
});
}
- $('#nav').mmenu({
+ this.menu.mmenu({
+
+ // Allow #anchor links to trigger correctly and close the menu
+ // Ref: https://github.com/FrDH/jQuery.mmenu/issues/687#issuecomment-279377172
+ onClick: {
+ preventDefault: function() {
+ $this.menuAPI.close();
+ }
+ },
+
"extensions": [
"pagedim-black"
],
"position": "right",
"zposition": "front"
},
+ "navbar": {
+ //add: false // Removes main title bars completely
+ title: "" // Hides the default "Menu" text
+ },
"navbars": navbars
});
- this.menuAPI = $('#nav').data('mmenu');
+ this.menuAPI = this.menu.data('mmenu');
+
+ // Bind API hooks (see http://mmenu.frebsite.nl/documentation/core/off-canvas.html#h4)
+ this.menuAPI.bind("open:finish", function () {
+ $this.menuIsOpen = true;
+ });
+
+ this.menuAPI.bind("close:finish", function () {
+ $this.menuIsOpen = false;
+ });
+
$(document).on('click', '#menuOpener', function (e) {
e.preventDefault();
$('#main header').append(menuOpener);
// Add holder list element for menu items
- this.menu.append('<ul></ul>');
+ this.menu.append('<ul id="menuList"></ul>');
try {
var skipHome = (window.localStorage.getItem('home') === '0');
}
/* Nav */
-#nav #locales {
+#menu #locales {
display: inline-block;
width: 22px;
height: 17px;
z-index: 12;
}
-.ltr #nav a#submitSearch {
+.ltr #menu a#submitSearch {
margin: 0 0 0 5px;
}
-.rtl #nav a#submitSearch {
+.rtl #menu a#submitSearch {
margin: 0 5px 0 0;
}
-#nav {
+#menu {
//position: relative;
//white-space: nowrap;
background-color: @menu-background;