demarches-normaliennes/app/javascript/new_design/buttons.js
2018-07-25 15:14:06 +02:00

11 lines
296 B
JavaScript

$(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');
}
});