react-scroll icon indicating copy to clipboard operation
react-scroll copied to clipboard

Scrolling inside a Layer

Open vog3nim opened this issue 4 years ago • 4 comments

I'm using react-scroll for focussing on special sections of an application that is rendered on a single page, which works fine as long as it's rendered in Fullscreen. But for some entrypoints there will be a layer (or overlay) opened where this app is rendered in (scroller and elements are implemented inside of this app). In this case the scrollTo-function leads to scrolling to the coordinates defined by the section-Elements, but only in the background instead of the contentLayer they're defined in.

Does anyone know how to bind this to the opened layer e.g. by setting special parameters, using css or something or will this be an issue created because of the implementation of the layer components? (These are created by an external service I have to use, so I'm not sure what exactly happens behind the scenes)

Thanks in advance

vog3nim avatar Aug 24 '20 13:08 vog3nim

We are having the exact same problem. It would be nice, if we could provide the scroller with a reference of the element it should scroll on. Is a feature like this planned?

dhwnr15 avatar Aug 28 '20 05:08 dhwnr15

Scrolling in a container is supported, checkout the examples.

fisshy avatar Aug 28 '20 06:08 fisshy

I am trying to use scrolling in a container, but fail.

I have a fixed modal, which is my container, some levels of nested elements and somewhere inside - my element I'd like to scroll to. But when I use scroller.scrollTo('Name', options) it scrolls to the top of my fixed container, not to the position of my element. As far as I can understand, here https://github.com/fisshy/react-scroll/blob/ad6d5cf6feb58e4fe0ef9e4a1ab94f714f732e9a/modules/mixins/utils.js#L33 point of scrolling is calculated as t.offsetTop, but it is always 0 in my case, because the element I want to scroll to has no offset from its parent, but its parent is not the container!

OlgaKozlova avatar Sep 30 '20 17:09 OlgaKozlova

give your outer container an id and give your links to this id like example below image

pkocak avatar Mar 03 '21 15:03 pkocak