Skip to content

Commit

Permalink
API 문서 스크롤 위치와 rootMargin 조정
Browse files Browse the repository at this point in the history
  • Loading branch information
CirnoV committed Nov 28, 2024
1 parent 0a5d353 commit 52298e2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/layouts/rest-api/nav-menu/NavMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default function NavMenu(props: Props) {
}
},
{
rootMargin: "-56px 0px 0px 0px", // gnb height
rootMargin: "-104px 0px 0px 0px", // gnb height
threshold: [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1],
},
);
Expand Down
3 changes: 2 additions & 1 deletion src/layouts/rest-api/nav-menu/NavMenuLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ export default function NavMenuLink(props: Props) {
onClick={() => {
sidebarOpen.set(false);
const el = document.getElementById(props.id);
const heading = el?.querySelector("h2, h3, h4, h5, h6");
requestAnimationFrame(() =>
el?.scrollIntoView({ behavior: "smooth", block: "center" }),
heading?.scrollIntoView({ behavior: "smooth" }),
);
}}
>
Expand Down

0 comments on commit 52298e2

Please sign in to comment.