admin管理员组文章数量:1314843
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).
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).
Share Improve this question edited Feb 8, 2018 at 14:31 Attila asked Mar 14, 2017 at 0:08 AttilaAttila 1,1774 gold badges21 silver badges47 bronze badges 7-
Try set
#pop-up {top: 100%;}
. Is that what you want? – hcheung Commented Mar 14, 2017 at 0:38 - It didn't fix the issue, sorry :( – Attila Commented Mar 14, 2017 at 1:06
- Well, seems to work on demo. Maybe I'm not quite understand what you want. – hcheung Commented Mar 14, 2017 at 1:27
-
I added
#pop-up {top: 100%;}
on demo as well (via chrome dev tools) and it doesn't work. I tried it locally as well. How are you getting it to work? – Attila Commented Mar 14, 2017 at 2:07 - Same, I made the changes via dev tools, and tried on both safari and chrome. With cache off. – hcheung Commented Mar 14, 2017 at 2:09
3 Answers
Reset to default 5I would remend the following changes to the CSS:
- Set
overflow: hidden
onbody
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
toauto
- Change the
top
andleft
to0
- Add
right
andbottom
and set to0
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.
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.
For me removing display: flex;
did the trick
本文标签: javascriptPopup modal being cut off at top of pageStack Overflow
版权声明:本文标题:javascript - Pop-up modal being cut off at top of page - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741971070a2407841.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论