Blank space under menu after scrolling on mobile devices
Clash Royale CLAN TAG#URR8PPP
Blank space under menu after scrolling on mobile devices
I have position fixed menu element which is hiding whenever you click/touch on darken area. And the problem is that whenever you are scrolling website this blank space appears under menu before it hides
screenshot with issue:
.
I tried to add more height to menu element and setting overflow: hidden to disable scrolling when menu is active but it didn't help. Also i tried to search about this but it's really hard for me to formulate accurate question with words to find some related answers or tips.
height: 100vh;
height: 100%;
@Rabbid76 I tried it but it don't quite do anything, because position fixed is relative to the screen so 100% equals 100vh :/
– menberusch
Aug 8 at 8:08
2 Answers
2
I figured out how actually position: fixed is working, and came up with idea how can i solve my issue. So basically, on touch devices position fixed is working only in one way(for example: if you set top: 0 and bottom: auto(or top: 0 and bottom: 0), there will be an empty space at bottom before menu hides, and if you set bottom: 0 and top: auto there will be opposite effect). So i came up with idea to create another layer with same bg-color and same animation effects but with bottom: 0 and top: auto for preventing this blank space on top/bottom side of the menu. So basically, yea, it did solve my issue. Maybe someone is facing same, so i decided to write down this answer.
thanks to @eisbehr for teaching me how to use this and a well learned lesson, I removed my previous answer.
body
margin: 0;
.forceHeight
position: relative;
height: 200vh;
background-color: lightgrey;
.menu
position: fixed;
right: 0;
top: 0;
bottom: 0;
background-color: blue;
<div class="forceHeight">
<div class="menu">
this is your fixed menu
</div>
asdf this has a lot of content
</div>
It didn't helped me. Actually this blank space only appears on touch devices. And on built in chrome device emulator everything working as excepted. I think it's related to same behaviour on top and bottom edges of page too. You know, like when the page is on the edge and you scroll the whole page is moving and there is like same blank space. I hope you get what am i talking about. Sorry for my english :)
– menberusch
Aug 8 at 8:13
@menberusch can you please provide a reproduceable example of your bug?
– ohfierce
Aug 8 at 8:17
1) i.imgur.com/AXCZU1U.jpg 2) i.imgur.com/odMmeLV.jpg Second image is after scrolling on the top of page. About this i was talking in my previous comment
– menberusch
Aug 8 at 8:25
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Can your try
height: 100vh;
instead ofheight: 100%;
?– jaydeep patel
Aug 8 at 7:51