Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1주차] 김동혁 미션 제출합니다. #2

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
9 changes: 7 additions & 2 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ document.addEventListener("DOMContentLoaded", function () {
const deleteButton = document.createElement("button");
deleteButton.textContent = "삭제";
deleteButton.onclick = function () {
todoList.removeChild(todoItem);
removeTodoFromStorage(todoText);
// 애니메이션 클래스 추가
todoItem.classList.add("animate-fade-out");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

애니메이션 넣어주니까 사용할 때 훨씬 보기 좋아요~! 좋습니다!!


todoItem.addEventListener("animationend", () => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

animationend를 사용해 애니메이션이 끝날 때 함수들이 실행돼서 좋은거 같아요.

todoList.removeChild(todoItem);
removeTodoFromStorage(todoText);
});
};

// 완료 체크 이미지 생성
Expand Down
19 changes: 17 additions & 2 deletions style.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ h1 {
margin: 0;
}

/* 애니메이션 */
/* 할일 추가 애니메이션 */
@keyframes slideDownFadeIn {
from {
opacity: 0;
Expand All @@ -25,12 +25,27 @@ h1 {
transform: translateY(0);
}
}

.animate-slide-down {
animation: slideDownFadeIn 0.2s ease-out forwards;
}
/* */
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

필요없는 주석은 삭제하는 것이 좋아요 > <


/* 할일 삭제 애니메이션 */
@keyframes fadeOutScaleDown {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

애니메이션보고 감탄했는데 keyframes로 하신거네요..! 멋져요 👍

from {
opacity: 1;
transform: scale(1);
}
to {
opacity: 0;
transform: scale(0.9);
}
}
.animate-fade-out {
animation: fadeOutScaleDown 0.3s ease-out forwards;
}
/* */

.wrapper {
width: 100%;
min-height: 100vh;
Expand Down