webdroid/js/button.js

20 lines
688 B
JavaScript
Raw Normal View History

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) );
2021-01-02 22:39:25 +01:00
};
});