Skip to content

Commit

Permalink
fix scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
huxulm committed Dec 23, 2024
1 parent 330df1f commit 0711557
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/app/cks/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,7 @@ export default function CKS() {
);
});
}, [questions]);
const [current, setCurrent] = useState(
contents ? { id: 0, content: contents[0] } : null
);
const [current, setCurrent] = useState({ id: 0, content: contents[0] });
const ref = useRef<HTMLIFrameElement>(null);
const answer = useMemo(() => {
return (
Expand Down Expand Up @@ -96,7 +94,7 @@ export default function CKS() {
className="answer"
onClick={() =>
scrollToAnswer(
`question-${current?.id}-|-${idMaps[current!.id - 1]}`
`question-${current.id + 1}-|-${idMaps[current!.id]}`
)
}
>
Expand Down

0 comments on commit 0711557

Please sign in to comment.