question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[FEATURE] use closest scroll container in useViewportScroll

See original GitHub issue

Is your feature request related to a problem? Please describe. useViewportScroll only works with the body element.

Describe the solution you’d like I’d like if useViewportScroll could optionally accept a ref to an element and use the closest scroll container.

Describe alternatives you’ve considered I noticed that the docs suggest rolling this yourself, but I think it could be helpful to provide out of the box.


I’d be happy to submit a PR with this functionality, please let me know 😊.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
DexterShepherdcommented, Nov 14, 2019

I’ve also ended up needing this feature. If help is needed with the PR I’m happy to chip in.

3reactions
joebentaylor1995commented, Mar 1, 2020

Is anything happening with this, really need this

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Find first scrollable parent - Stack Overflow
This method finds the nearest ancestor that allows scrolling. In other words, the .scrollParent() method finds the element that the currently selected element ......
Read more >
How to Create a Scroll Progress Animation with Framer ...
For our use case, we will be utilizing the scrollYProgress value that is returned since we want to track the progress between 0...
Read more >
Accessibility | Framer for Developers
In this guide, we'll learn how to use the reducedMotion option and ... which will update's a motion component's y position as the...
Read more >
Framer Motion Tutorials: Make More Advanced Animations
Framer Motion lets you use the same animation library both in prototyping ... ParallaxBox component animation is set in motion by scrolling, ...
Read more >
Get the first scrollable parent of an element - HTML DOM
For each parent node, we check if it is a scrollable node. const isScrollable = function (ele) { const hasScrollableContent = ele.scrollHeight >...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found