$(document).ready(() => {
- // Add menu opener icon
- $(`<a href="#${menuID}" id="${menuOpenerID}"><div></div></a>`).appendTo('body');
-
// Add menu overlay element
$(`<div id="${menuID}-overlay"></div>`).appendTo('body');
+ // Remove inline style that hides menu while loading
+ $(`#${menuID}`).attr('style', '');
+
// Configure Sidr
$(`#${menuOpenerID}`).sidr({
name: menuID,
// Actual menu built by Sidr plugin
#mobile-menu
- background-color: #fff
- padding: 80px 30px 30px
+ @apply bg-white font-semibold
+ padding: 120px 35px 30px
width: 320px
z-index: 1000
.menu-item
padding: 0.5em 0
- border-bottom: 1px solid #D4D4D4
// Content overlay when menu is open
&-overlay
//=== Burger menu icon + animation
&-opener
position: absolute
- width: 30px
+ width: 48px
height: @width
top: @width
- left: @width
- padding: 5px 0 // To match size of close X inside menu
+ left: 30px
display: flex
flex-direction: column
justify-content: space-between
z-index: 2000 // Needs to sit above Sidr
pointer-events: auto // MMenu disables pointer events outside the menu when it's open
+ cursor: pointer
transform: translateZ(0)
transition-property: opacity
transition-duration: 0.3s
display: none
&:hover
- @apply text-red !important
-
- &:after, &:before, div // 3 lines in burger icon
- content: ''
- width: 100%
- background-color: currentColor
- display: block
- height: 2px
- transition: all 0.3s ease-in-out
+ .burger-bg
+ fill: theme('colors.blue')
+
+ .burger-bg
+ transition: fill 0.3s
- &:after // Shorter bottom line
- width: 50%
+ .burger-top, .burger-middle, .burger-bottom // 3 lines in burger icon
+ transition: all 0.3s ease-in-out
+ transform-origin: center
// Morph to a cross when menu opens
.sidr-open &
- //color: #fff // Controls colour of lines
- &:before // Top line
- transform: translateY(9px) rotate(135deg)
+ .burger-top // Top line
+ transform: translate(-5px, 5px) rotate(45deg)
- &:after // Bottom line
- transform: translateY(-9px) rotate(-135deg)
- width: 100%
+ .burger-bottom // Bottom line
+ transform: translate(-5px, -6px) rotate(-45deg)
- div // Middle line
+ .burger-middle // Middle line
transform: scale(0)
{{-- Mobile menu --}}
- <nav id="mobile-menu">
+ <nav id="mobile-menu" style="display: none">
{{--<a href="#" class="close" aria-label="<?= _('Fermer le menu') ?>">@svg('menu-close', ['class' => 'menu-close-icon'])</a>--}}
- <ul class="nav-items">
+ <ul class="nav-items mb-4">
<li class="menu-item"><a href="{{ get_home_url() }}">{{ __('Accueil', 'usines') }}</a></li>
@if (has_nav_menu('primary_navigation_left'))
!!}
@endif
</ul>
+
+ @include('partials.social-networks')
+
</nav>
</header>
+
+{{-- Mobile Menu Opener (placed outside the header so it can be independent from the menu --}}
+<svg id="mobile-menu-opener" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48.4 47.4">
+ <path fill="#EB958A" class="burger-bg" d="M48.4 22.7c0 5.1-.6 9.8-3.4 13.7-4.3 6-12.3 11-20.3 11-3 0-6-.6-8.6-1.6-8.8-3.5-16-13-16-23 0-4.4 2.2-8.5 4.3-12.1C8.4 3.7 16 0 24.7 0c7 0 13.4 1.1 17.7 6 3.7 4.1 6 10.6 6 16.7z"/>
+ <g fill="#fff">
+ <path class="burger-top" d="M34.8 16.6H13.6c-.4 0-.8-.3-.8-.8s.3-.8.8-.8h21.2c.4 0 .8.3.8.8s-.4.8-.8.8z"/>
+ <path class="burger-middle" d="M34.8 24.4H13.6c-.4 0-.8-.3-.8-.8s.3-.8.8-.8h21.2c.4 0 .8.3.8.8s-.4.8-.8.8z"/>
+ <path class="burger-bottom" d="M34.8 32.2H13.6c-.4 0-.8-.3-.8-.8s.3-.8.8-.8h21.2c.4 0 .8.3.8.8s-.4.8-.8.8z"/>
+ </g>
+</svg>