Built Portfolio Page - 5 (Link scroll)

Steps:

  1. Add id to different element
  2. Add scroll-mt propriety to classman

Modify Intro.tsx:

1
2
3
4
5
6
7
8
export default function Intro() {
return (
<section
id = "home"
className='mb-28 max-w-[50rem] text-center sm:mb-0
scroll-mt-[100rem]'
>
....

Modify About.tsx:

1
2
3
4
5
6
7
8
9
export default function About() {
return (
<motion.section className='mb-28 max-w-[45rem] text-center leading-8 sm:mb-40 scroll-mt-28'
initial={{ opacity:0, y:100}}
animate={{ opacity:1, y:0 }}
transition={{ delay: 0.175 }}
id="about"
>
...

Modify Projects.tsx

1
2
3
4
export default function Projects() {
return (
<section id="projects" className='scroll-mt-28'>
...

Scroll smoothly

Modify layout.tsx:

1
2
3
4
5
6
7
8
export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<html lang="en" className='!scroll-smooth'>
...

请我喝杯咖啡吧~

支付宝
微信