I created a file collapse.js in the theme of my site. It works very well.
On this page :
https://www.s1biose.com/article
When I open the menu on the right and click on the "Rechercher" action button, the collapse menu remains open.
How do I close the collapse menu automatically when I click on the "Rechercher" button ?
The file already contains some rules.
(function ($) {
$('#navbar-collapse-first').on('show.bs.collapse', function () {
$('#navbar-collapse-second').collapse('hide');
})
$('#navbar-collapse-second').on('show.bs.collapse', function () {
$('#navbar-collapse-first').collapse('hide');
})
$('#navbar-collapse-first').on('show.bs.collapse', function () {
$('body').addClass('overlay-is-navbar-collapse');
});
$('#navbar-collapse-first').on('hide.bs.collapse', function () {
$('body').removeClass('overlay-is-navbar-collapse');
});
$('#navbar-collapse-second').on('show.bs.collapse', function () {
$('body').addClass('overlay-is-navbar-collapse');
});
$('#navbar-collapse-second').on('hide.bs.collapse', function () {
$('body').removeClass('overlay-is-navbar-collapse');
});
})(window.jQuery);
<div data-drupal-selector="edit-actions" class="form-actions form-group js-form-wrapper form-wrapper" id="edit-actions">
Rechercher
$('#rechercher').on('click', function () {
$('#navbar-collapse-second').removeClass('in');
});
add id rechercher to your button