Attila
Attila

Reputation: 1167

Pop-up modal being cut off at top of page

Here is a live demo of the modal (it should open after a few seconds. UPDATE: this link now shows the finished version).

Here is the GitHub repo with all the files. (UPDATE: this link now shows the finished version).

When I scroll up, the top part of the pop-up is cut off but I can't scroll up to see it, despite having overflow-y: scroll; on the pop-up container.

This problem happens (in case you can't see it in the demo) on smaller resolution screens (see here) or when the screen width is contracted (see here).

Upvotes: 3

Views: 11780

Answers (3)

Jude
Jude

Reputation: 11

It seems like I'm a little bit late to reply, but setting the css property of the modal itself to:

max-height: 100%;

May repair this issue.

Upvotes: 1

Jacopo
Jacopo

Reputation: 163

For me removing display: flex; did the trick

Upvotes: -1

Pango
Pango

Reputation: 673

I would recommend the following changes to the CSS:

  • Set overflow: hidden on body when the popup is open. That will stop the annoying scrolling of the body when trying to scroll the popup.
  • Remove the translate on #popup
  • Change the margin to auto
  • Change the top and left to 0
  • Add right and bottom and set to 0

The last items will automatically center the popup content in the window and you will be able to scroll within the popup container div (this works because the position is set to absolute).

Also might want to set background-color: #fff on #top-section so that if the window is short you can still see the text otherwise it ends up with black text on the dark transparent background.

Upvotes: 5

Related Questions