Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 6x 3x 3x 3x 3x 4x 4x 6x | export default function initCloseButton() {
/**
Attaches event listener for hide notification on close button click.
@param {HTMLElement} closeButton The notification close button element.
*/
function setupCloseButton(closeButton) {
closeButton.addEventListener("click", function (event) {
const target = event.target.getAttribute("aria-controls");
const notification = document.getElementById(target);
Eif (notification) {
notification.classList.add("u-hide");
}
});
}
// Set up all notification close buttons.
const closeButtons = document.querySelectorAll(
".p-notification [aria-controls]"
);
for (let i = 0, l = closeButtons.length; i < l; i++) {
setupCloseButton(closeButtons[i]);
}
}
|