Menu

Our phone CTA bar reads rectangles every frame instead of using IntersectionObserver, and a fast fling is why
📰

Our phone CTA bar reads rectangles every frame instead of using IntersectionObserver, and a fast fling is why

DEV Community: css·Daniel Pertu·13 days ago
#ugrOhnNc
#devtocss#devto#dev#scroll#employer
Long article (1509 words) — no AI summary yet.
Reading 0:00
15s threshold

CogniPrep's long entry pages are long. A provider hub or an employer guide runs thousands of pixels, and the primary action sits near the top. On a phone, somebody who reads to the end has nothing to tap without scrolling back.

The fix is the oldest pattern on mobile web: a bar pinned to the bottom with the action in it. The interesting part is that almost every decision in the 133 lines is a decision not to do the obvious thing.

It shows between two points, not from a threshold

The bar is not "appears after 400px". It shows after the page's own early call to action has scrolled up under the header, and hides again once the page's closing call to action or the footer comes into view. So it never doubles up with a button already on screen, and it is gone before the footer, which is what stops it covering anything.

Both ends are elements, not offsets. The start is an id passed in as a prop. The end is any element carrying a data attribute, or the footer :

const ends = Array . from ( document .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.