fixed menu burger disappear when logged in

This commit is contained in:
Valentin 2024-10-11 11:32:45 +02:00
parent bddb4b2088
commit 9f8f9f3a62
1 changed files with 16 additions and 0 deletions

View File

@ -53,6 +53,8 @@ import router from './router/router';
const mapStore = useMapStore(); const mapStore = useMapStore();
app.mount('#content-modale'); app.mount('#content-modale');
setHamburgerWhenLogged();
Drupal.behaviors.customLeafletInteraction = { Drupal.behaviors.customLeafletInteraction = {
attach: function(context, settings) { attach: function(context, settings) {
$(context).on('leafletMapInit', function (e, settings, map, mapid, markers) { $(context).on('leafletMapInit', function (e, settings, map, mapid, markers) {
@ -162,6 +164,20 @@ import router from './router/router';
}) })
} }
function setHamburgerWhenLogged() {
if (drupalSettings.user.uid != 0) {
const menuBurger = document.querySelector('#hamburger');
const menuTitle = document.querySelector('#menu-title');
const menuContainer = document.querySelector('#block-caravane-mainnavigation > #menu > ul');
const header = document.querySelector('.dialog-off-canvas-main-canvas');
const headerTop = header.getBoundingClientRect().top;
menuTitle.style.top = `${headerTop}px`;
menuBurger.style.top = `${headerTop}px`;
menuContainer.style.paddingTop = `${headerTop}px`;
}
}
function setupEtapeMapPopup(store, map) { function setupEtapeMapPopup(store, map) {
const icons = document.querySelectorAll('.leaflet-map-divicon'); const icons = document.querySelectorAll('.leaflet-map-divicon');
for (let icon of icons) { for (let icon of icons) {