Hello everyone. I have a hamburger menu on a page when in mobile version. Quick question is how can i make it to auto close after click. Thanks in advance.
Hello @MrPrice there you have an option, that or when you click a link or click outside the menu it will close the toggle menu:
- Go to Page Settings:
- Go to the tab code:
- Select the option Footer:
- Add the following code:
<script>
$(document).on('click', function() {
return $('.collapse').collapse('hide');
});
</script>
Hope it helps you…
There you have your site working:
1 Like
Hello @PeteSharp in case of BS5 I have a different approach:
In the menu items I add two Custom Attributes, like this, for who needs:
1st - Click in the list:
2nd - In the custom Attributes:
3rd - Add the following ones:
Name: data-bs-toggle
Value: collapse
And
Name: data-bs-target
Value: .navbar-collapse.show (dont forget both dot)
And voila:
Hope it helps …