Skip to content

Commit

Permalink
add: 자동 스크롤 기능 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
Choi-Jinwoo committed Aug 6, 2021
1 parent 204e7ed commit 670e2c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions frontend/src/views/category-expenditure/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
border-radius: 10px;
padding: 32px;
}

.category-expenditure__title {
margin-bottom: 32px;
color: var(--title-active);
Expand Down
11 changes: 10 additions & 1 deletion frontend/src/views/category-expenditure/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,16 @@ class CategoryExpenditureView extends View {
}

show (): void {
$('.category-expenditure')?.classList.remove('disappear');
const $categoryExpenditure = $('.category-expenditure');
if ($categoryExpenditure !== null) {
$categoryExpenditure.classList.remove('disappear');
const { top } = $categoryExpenditure.getBoundingClientRect();

window.scrollTo({
top,
behavior: 'smooth'
});
}
}

protected render (): void {
Expand Down

0 comments on commit 670e2c4

Please sign in to comment.