Skip to content

Commit 2f1edc1

Browse files
author
devbyali
committed
adding animation
1 parent 64b27c8 commit 2f1edc1

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

app.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ function deleteTodo(e) {
4747
//delete
4848
if (item.classList[0] === "trash-btn") {
4949
const todo = item.parentElement;
50-
todo.remove();
50+
//Animation
51+
todo.classList.add("fall");
52+
todo.addEventListener("transitionend", function () {
53+
todo.remove();
54+
});
5155
}
5256
//check mark
5357
if (item.classList[0] === "complete-btn") {

style.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ form button:hover {
6868
display: flex;
6969
justify-content: space-between;
7070
align-items: center;
71+
transition: all 0.5s ease;
7172
}
7273

7374
.todo li {
@@ -96,3 +97,13 @@ form button:hover {
9697
.fa-check {
9798
pointer-events: none;
9899
}
100+
101+
.completed {
102+
text-decoration: line-through;
103+
opacity: 0.5;
104+
}
105+
106+
.fall {
107+
transform: translateY(8rem) rotateZ(20deg);
108+
opacity: 0;
109+
}

0 commit comments

Comments
 (0)