2021-01-02 22:39:25 +01:00
|
|
|
addEventListener("load", () => {
|
|
|
|
const onAnimationFinished = (e) => {
|
|
|
|
e.target.remove();
|
|
|
|
};
|
2021-01-02 23:20:45 +01:00
|
|
|
const onClick = (e, btn) => {
|
2021-01-02 22:39:25 +01:00
|
|
|
const clickElement = document.createElement("div");
|
|
|
|
clickElement.className = "click";
|
|
|
|
clickElement.addEventListener("animationend", onAnimationFinished);
|
2021-01-02 23:20:45 +01:00
|
|
|
btn.appendChild(clickElement);
|
2021-01-02 22:39:25 +01:00
|
|
|
};
|
|
|
|
for (const btn of document.getElementsByClassName("btn")) {
|
|
|
|
btn.addEventListener("focusin", () => {
|
|
|
|
console.log("IN");
|
|
|
|
});
|
|
|
|
btn.addEventListener("focusout", () => {
|
|
|
|
console.log("OUT");
|
|
|
|
});
|
2021-01-02 23:20:45 +01:00
|
|
|
btn.addEventListener("click", (e) => onClick(e, btn) );
|
|
|
|
|
|
|
|
// Add backdrop-filter replacement
|
|
|
|
const bdfr = document.createElement("div");
|
|
|
|
bdfr.className = "shadow";
|
|
|
|
bdfr.innerHTML = btn.innerHTML;
|
|
|
|
btn.appendChild(bdfr);
|
2021-01-02 22:39:25 +01:00
|
|
|
};
|
|
|
|
});
|