});
},
- openCart() {
- document.body.classList.add('cart-open');
+ openCart(event) {
+ // Only trigger cart popup on larger screens
+ // On smaller screens, the link will behave as normal.
+ if (event && window.innerWidth > menu_breakpoint) {
+ event.preventDefault();
+ document.body.classList.add('cart-open');
+ }
},
closeCart() {
document.body.classList.remove('cart-open');
'DOMContentLoaded', () => {
let nav=document.getElementById("mobile-nav");
window.mmenu = new MmenuLight(nav, {title: "Menu", theme: 'dark'});
+ window.menu_breakpoint = 1023; // Note: this should match the menu CSS breakpoint in setup.styl!
- mmenu.enable('(max-width: 1000px)'); // Note: this should match the menu CSS breakpoint!
+ mmenu.enable(`(max-width: ${menu_breakpoint}px)`);
mmenu.offcanvas();
- nav.classList.remove('hidden')
+ nav.classList.remove('hidden');
document.querySelector(`a[href="#menu"]`)
.addEventListener('click', (event) => {
// Breakpoints in Rupture (https://github.com/jescalan/rupture)
$breakpoint-columns = 768px // NOTE: this should align with the 'sm' screen value in tailwind.config.js
+$breakpoint-menu = 1024px // This needs to match the MMenu activation setting in menu.js
rupture.scale = 0 400px 768px 1024px
rupture.scale-names = 'small' 'medium' 'large'
rupture.anti-overlap = -1px // Results in +below(1000px) being max-width: 999px and +above(1000px) being min-width: 1000px
.cart-header-popout
display: block
+ // Hide main menu to avoid awkward overlaps with the menu popout
+ #menu
+ visibility: hidden
+ pointer-events: none
+
// Also show overlay under cart popout
.body-overlay
position: fixed
.site-header
@apply bg-navy text-white text-lg font-display font-medium antialiased
- +below(1000px)
+ +below($breakpoint-menu)
.mobile-menu-icon
display: block
cursor: pointer
#mobile-nav
- display: none;
- +below(1000px)
- &.hidden
- display none
- display block
+ +below($breakpoint-menu)
+ display: block
</nav>
@if (config('features.quote'))
- <div class="cart-header text-right flex items-center cursor-pointer hover:text-blue" @click="openCart">
+ <a href="{{ $nav->getHrefByName('cart') }}"
+ @click="openCart"
+ class="cart-header text-right flex items-center cursor-pointer text-white hover:text-blue">
@include('partials.cart')
- </div>
+ </a>
<div class="cart-header-popout">
<div class="cart-header-popout-title flex justify-between items-center px-1v py-1v">
-<nav id="mobile-nav" class="hidden">
- {!! CubistMenu::get('#main','mobile')->asUl() !!}
-</nav>
+<div class="hidden">
+ <nav id="mobile-nav">
+ {!! CubistMenu::get('#main','mobile')->asUl() !!}
+ </nav>
+</div>