Skip to content

fix: add scroll-to-top button to remaining pages (closes #920) - #922

Open
Quantumboy80 wants to merge 1 commit into
adithyan-css:mainfrom
Quantumboy80:feat/scroll-to-top-button
Open

fix: add scroll-to-top button to remaining pages (closes #920)#922
Quantumboy80 wants to merge 1 commit into
adithyan-css:mainfrom
Quantumboy80:feat/scroll-to-top-button

Conversation

@Quantumboy80

Copy link
Copy Markdown

Closes #920

What was actually going on

While investigating, I found the feature was already half-built:

  • script.js already has a working scrollToTop() function and a scroll
    listener wired to #scrollTopBtn
  • style.css already had a #scrollTopBtn:hover rule, but no base rule
    (no position, size, or default display: none) — so the button was
    unstyled wherever it existed
  • The button element itself was present on index.html, about.html,
    privacy-policy.html, refund-policy.html, and terms-of-service.html,
    but missing from birthday.html, contact.html, favourites.html,
    and products.html

Changes

  • Added the missing base CSS for #scrollTopBtn (fixed position,
    bottom-right, circular, dark mode variant, mobile sizing)
  • Added the missing <button id="scrollTopBtn" onclick="scrollToTop()">
    element to the 4 pages that didn't have it
  • Positioned per the existing comment in the WhatsApp button's CSS
    (bottom: 80px; /* sits above the back-to-top button */), so the two
    buttons now stack correctly instead of overlapping

Testing

Tested locally on all 4 fixed pages plus the 2 pages that already had
the button (to confirm no regression), in both light/dark mode and at
mobile width:

  • Button appears after ~300px scroll, hidden at top
  • Smooth-scrolls to top on click
  • Sits correctly below the WhatsApp button, no overlap
  • Responsive sizing on mobile

Note for maintainer

Not part of this PR, but I noticed scrollToTop() is defined twice in
script.js (once ~line 1020, once ~line 1621) — harmless dead code,
happy to clean it up in a separate PR if useful.

@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown

@Quantumboy80 is attempting to deploy a commit to the adithyansubramani1-1657's projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Scroll-to-Top Button at the Bottom Right Corner

1 participant