rando
December 7, 2019, 7:39pm
1
Hi,
I have anchor links in my hamburger menu in mobile, however when I click them, they don’t close the mobile menu view, they just go to the anchored content and keep the menu view open. Can someone help with this? Appreciate it a lot, thanks!
Here is my site Read-Only: https://preview.webflow.com/preview/main-do-not-delete?utm_medium=preview_link&utm_source=dashboard&utm_content=main-do-not-delete&preview=5a0bbe91f8076cb2dbcc39e2106b96f0&mode=preview
shokoaviv
(Moshe Assulin)
December 7, 2019, 11:17pm
2
alexdixon
(Alex Dixon)
January 29, 2020, 10:42am
3
To make external anchor links close the mobile menu, add this code snippet into your custom code via the project settings:
<script>
$('.w-nav-menu').on('click', 'a', function() {
$('.w-nav-button').triggerHandler('tap');
});
</script>
1 Like
Hi Alex,
Please could you explain where this code needs adding? and which parts of the code I should change as I have renamed my mobile menu classes.
Thanks,
Matt
s.delaporte
(Sylvain_de-la-Porte)
July 26, 2023, 6:46am
5
Add the code into : Setting / Custom code / Footer code, save and publish.