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.

Scrolling inside different containers

See original GitHub issue

Right now React-Scroll-To only supports scrolling on the window, but there are use-cases where a user might want to scroll inside different containers (say a div).

Proposed Idea: Add a new prop to <ScrollTo> to accept a ‘scrolling location’. This would look like:

<ScrollTo container={divRef}>
    {scroll => ... }
</ScrollTo>

Where the container could be a Ref passed in. If nothing is given in the container prop, default to using window.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:11 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
ganderzzcommented, Nov 28, 2017

@newyork-anthonyng My wording was off, I was thinking of it more like reusable functions instead of an actual class hierarchy. But thinking about it more, it would require a single global instance of a ScrollArea array.

I’m in favor of option 1 due to a single global object sounding like a bad idea. Option 1 would better encapsulate the ScrollArea array into each instance of ScrollTo and ScrollToHOC. Playing around with the idea, here’s an example of option 1.

0reactions
ganderzzcommented, Nov 30, 2017

@newyork-anthonyng No problem, always good to have a second pair of eyes on things. I’ll get a PR made up, and close this issue out! 😄

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSS: how to get scrollbars for div inside container of fixed height
Is there a way to have a short height and hide the scroll-bar at the same time? this way when users drag down...
Read more >
Scroll container - MDN Web Docs Glossary
The scroll container allows the user to scroll through parts of the overflow region that would otherwise be clipped and hidden from view....
Read more >
How To Create Horizontal Scrolling Containers - codeburst
Let's first create our container and our children divs inside of it that will scroll horizontally. The HTML is pretty simple. <div class="scrolling-wrapper">...
Read more >
Creating a Nested Scroll Using Containers | ProtoPie Blog
Learn how to create a horizontal and a vertical scroll for your prototype by using containers in ProtoPie.
Read more >
Creating horizontal scrolling containers the right way [CSS Grid]
The scrolling container​​ Using grid-template-columns we can set up how much space we want each card should take up — in this example,...
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