On utilise un modal pour supprimer le vote
This commit is contained in:
parent
2fc7030b34
commit
665cd027fb
5 changed files with 86 additions and 9 deletions
|
@ -45,14 +45,43 @@
|
|||
});
|
||||
});
|
||||
|
||||
// Interact with modals
|
||||
var $modals = document.querySelectorAll('.modal') || [];
|
||||
var $modalButtons = document.querySelectorAll('.modal-button') || [];
|
||||
var $modalCloses = document.querySelectorAll('.modal-background, .modal-close, .modal-card-head .delete, .modal-card-foot .button-close') || [];
|
||||
|
||||
$modalButtons.forEach(function($el) {
|
||||
$el.addEventListener('click', function() {
|
||||
var target = $el.dataset.target;
|
||||
var $target = document.getElementById(target);
|
||||
document.documentElement.classList.add('is-clipped');
|
||||
$target.classList.add('is-active');
|
||||
});
|
||||
});
|
||||
|
||||
$modalCloses.forEach(function($el) {
|
||||
$el.addEventListener('click', (event) => {
|
||||
event.stopPropagation();
|
||||
document.documentElement.classList.remove('is-clipped');
|
||||
$modals.forEach(function($el) {
|
||||
$el.classList.remove('is-active');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
document.addEventListener('keydown', (event) => {
|
||||
var e = event || window.event;
|
||||
if (e.keyCode === 27) {
|
||||
$dropdowns.forEach(($dropdown) => {
|
||||
$dropdown.classList.remove('is-active');
|
||||
});
|
||||
document.documentElement.classList.remove('is-clipped');
|
||||
$modals.forEach(function($el) {
|
||||
$el.classList.remove('is-active');
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue