demarches-normaliennes/app/javascript/new_design/buttons.js
2018-08-13 15:17:13 +02:00

13 lines
321 B
JavaScript

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