React-modal: Scrolling the Modal content

Created on 5 Jun 2017  路  6Comments  路  Source: reactjs/react-modal

Summary:

I included class rule for preventing background scrolling

    .ReactModal__Body--open {
        overflow: hidden;
        position: fixed;
        width: 100%;
        height: 100%;
    }

but when the modal opens I want to scroll the content inside of it. Can someone help me I am not able to find an appropriate solution in closed issues?

question

Most helpful comment

Hmm, ok. You can make a frame for the scrollable region.

<Modal ...>
  <div className="frame"> <!-- define the height and overflow-y: auto for frame -->
    <div className="scroll"> <!-- wrapper for the content -->
          [...] <!-- your content -->
    </div>
  </div>
</Modal>

Something like this would work, probably you will need to make some tweaks on this example.

All 6 comments

Hi @mmarinm, do you mean the content inside de overlay or the real content inside the modal?

The content inside that modal

Hmm, ok. You can make a frame for the scrollable region.

<Modal ...>
  <div className="frame"> <!-- define the height and overflow-y: auto for frame -->
    <div className="scroll"> <!-- wrapper for the content -->
          [...] <!-- your content -->
    </div>
  </div>
</Modal>

Something like this would work, probably you will need to make some tweaks on this example.

Ok, Thank you, It might be also related to the library I use for smooth scrolling. I decided to use router instead of the modal

@diasbruno your solution works like a charm. 馃専 Thanks a lot for your help!

@Monte9 I've updated the example, because it was really bad code. :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

leoasis picture leoasis  路  4Comments

gavmck picture gavmck  路  3Comments

phaedryx picture phaedryx  路  4Comments

emwee picture emwee  路  4Comments

yaoyao1024 picture yaoyao1024  路  3Comments