demarches-normaliennes/app/javascript/new_design/buttons.js

12 lines
296 B
JavaScript
Raw Normal View History

$(document).on('click', 'body', () => {
$('.button.dropdown').removeClass('open');
});
$(document).on('click', '.button.dropdown', event => {
event.stopPropagation();
const $target = $(event.target);
if ($target.hasClass('button', 'dropdown')) {
$target.toggleClass('open');
}
});