Skip to content

Make footer visible only with scroll #573

@mariana2103

Description

@mariana2103

One way to do it:

  • Create a new file called FooterWrapper.tsx inside src/components/layout/.
  • Do NOT change Footer.tsx
  • In the /src/components/layout/index.tsx where we currently have Footer , replace it with FooterWrapper so the wrapper controls when the footer appears.

What to do in the wrapper:

  • Create a state variable that starts as false (footer hidden). (using useState)
  • Add a scroll listener using useEffect that checks window.scrollY.
  • Add a check that makes the footer visible once window.scrollY passes a small threshold (around 100px), so it only appears after the user starts scrolling.
  • When the state is true, show the footer; when false, hide it.
  • Wrap the inside a div whose CSS classes depend on that state (opacity 0 when hidden, opacity 100 when visible).

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions