Skip to content

Commit a0c77d7

Browse files
authored
Merge pull request #3618 from codeeu/dev
Dev
2 parents c4e4cf5 + 6942107 commit a0c77d7

2 files changed

Lines changed: 33 additions & 13 deletions

File tree

public/js/ext/functions.js

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
var $ = jQuery.noConflict();
22

3+
function codeweekMobileMenuLinkClick(e) {
4+
var $link = $(this);
5+
var $submenu = $link.parent().children('ul');
6+
7+
if (!$submenu.length) {
8+
return;
9+
}
10+
11+
var href = $link.attr('href') || '';
12+
var isVoidHref = !href || href === '#' || href.indexOf('javascript:') === 0;
13+
var clickedArrow = $(e.target).closest('.arrow-icon').length > 0;
14+
15+
if (clickedArrow || isVoidHref) {
16+
e.preventDefault();
17+
$submenu.toggleClass('show');
18+
return false;
19+
}
20+
}
21+
322
$.fn.inlineStyle = function (prop) {
423
return this.prop("style")[$.camelCase(prop)];
524
};
@@ -879,9 +898,7 @@ var SEMICOLON = SEMICOLON || {};
879898
if ( $().superfish ) {
880899
var menuSelector = '#primary-menu > ul';
881900
$(menuSelector).superfish('destroy');
882-
$('#primary-menu ul li a').click(function() {
883-
$(this.parentNode).children('ul').toggleClass('show')
884-
});
901+
$('#primary-menu ul li a').click(codeweekMobileMenuLinkClick);
885902
}
886903
},
887904

@@ -2427,9 +2444,7 @@ var SEMICOLON = SEMICOLON || {};
24272444
});
24282445
if( SEMICOLON.isMobile.any() || !$body.hasClass('device-lg')){
24292446
$body.addClass('device-touch');
2430-
$('#primary-menu ul li a').click(function() {
2431-
$(this.parentNode).children('ul').toggleClass('show')
2432-
})
2447+
$('#primary-menu ul li a').click(codeweekMobileMenuLinkClick);
24332448
}
24342449

24352450
/*DROPDOWN MENUS*/

resources/views/layout/menu.blade.php

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,22 @@ class="cookweek-link hover-underline !text-[#1C4DA1] !text-[16px]"
9090
{{-- resources --}}
9191
<li class="main-menu-item">
9292
<a
93-
class="cookweek-link hover-underline !text-[#1C4DA1] !text-[16px] cursor-pointer"
94-
onclick="document.body.clientWidth > 1280 && (window.location.href='{{ route('educational-resources') }}')"
93+
class="cookweek-link hover-underline !text-[#1C4DA1] !text-[16px]"
94+
href="{{ route('educational-resources') }}"
9595
>
9696
@lang('menu.resources')
9797
<img class="arrow-icon" src="/images/chevron-down-icon.svg" alt="">
9898
</a>
9999
<ul class="sub-menu">
100100
<li class="menu-title max-xl:!hidden">
101-
<a class="flex gap-2 items-center" href="{{route('educational-resources')}}">
101+
<a class="flex gap-2 items-center" href="{{route('educational-resources')}}">
102102
@lang('menu.resources')
103103
<img src="/images/arrow-right-icon.svg" class="menu-title-icon" />
104104
</a>
105105
</li>
106+
<li class="xl:hidden">
107+
<a class="cookweek-link hover-underline" href="{{ route('educational-resources') }}">@lang('menu.resources')</a>
108+
</li>
106109
<li class="flex flex-col gap-16 xl:flex-row">
107110
@php
108111
$resourcesDropdownSections = $resourcesDropdownSections ?? collect();
@@ -231,13 +234,14 @@ class="absolute top-0 left-0 w-full h-full"
231234
{{-- community --}}
232235
<li class="main-menu-item">
233236
<a
234-
class="cookweek-link hover-underline !text-[#1C4DA1] !text-[16px] cursor-pointer"
235-
onclick="document.body.clientWidth > 1280 && (window.location.href='{{ route('community') }}')"
237+
class="cookweek-link hover-underline !text-[#1C4DA1] !text-[16px]"
238+
href="{{ route('community') }}"
236239
>
237240
@lang('community.titles.0')
238241
<img class="arrow-icon" src="/images/chevron-down-icon.svg" alt="">
239242
</a>
240243
<ul class="sub-menu">
244+
<li class="xl:hidden"><a class="cookweek-link hover-underline" href="{{ route('community') }}">@lang('community.titles.0')</a></li>
241245
<li><a class="cookweek-link hover-underline" href="{{ route('grassroots-grants') }}">@lang('menu.grassroots_grants')</a></li>
242246
</ul>
243247
</li>
@@ -290,13 +294,14 @@ class="cookweek-link hover-underline !text-[#1C4DA1] !text-[16px]"
290294
{{-- blog --}}
291295
<li class="main-menu-item">
292296
<a
293-
class="cookweek-link hover-underline !text-[#1C4DA1] !text-[16px] cursor-pointer"
294-
onclick="document.body.clientWidth > 1280 && (window.location.href='https://codeweek.eu/blog/')"
297+
class="cookweek-link hover-underline !text-[#1C4DA1] !text-[16px]"
298+
href="https://codeweek.eu/blog/"
295299
>
296300
@lang('menu.blog')
297301
<img class="arrow-icon" src="/images/chevron-down-icon.svg" alt="">
298302
</a>
299303
<ul class="sub-menu">
304+
<li class="xl:hidden"><a class="cookweek-link hover-underline" href="https://codeweek.eu/blog/">@lang('menu.blog')</a></li>
300305
<li><a class="cookweek-link hover-underline" href="https://forms.office.com/Pages/ResponsePage.aspx?id=18F13DIal06vkB3AGRHqbCnyIKB_vXdLsUgagfjd7DRUN1dZTVYxSkJNQ1VWSlVZNlpBOFAyN0g4UC4u&amp;embed=true" target="_blank" rel="noopener">@lang('menu.share_your_stories')</a></li>
301306
</ul>
302307
</li>

0 commit comments

Comments
 (0)