2

I'm making a new website where I want my navbar fixed top when scrolling. It works, but on mobile there is white space on top or bottom when we scroll. The problem is than I have a nav coming from left side on mobile. This nav doesn't moove when I scroll, no the top navbar go under the left navbar and its really ugly.

Here is my website if you don't understand https://www.hytalefrance.net

I've tried something like this:

overscroll-behavior: none;

But It change nothing

body {
  height: 100%;
  overflow: auto;
}

Do nothing to

It's a classic bootstrap 4 navbar, but I don't use fixed-top class to make it fixed, it's a custom class similar to fixed-top

.sticky.is-sticky {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  z-index: 1000;

}

I would like the whitespace on mobile disappears.

Some screenshot taken on my mobile (iPhone 6)

I'm actually scrolling down: I'm actually scrolling down

When nav is open:

When nav is open

When I scroll with nav open: When I scroll with nav open

2 Answers2

0

I guess you're taking about inertial scroll behavior caused by over scrolling a webpage in iPhone. There is no ideal fix for this problem.

There're few partial solutions that may / maynot work in your case
- How to disable inertial scrolling on body for iOS browsers?
- ipad safari: disable scrolling, and bounce effect?

Though, It is not recommended to prevent it. Doing so will intercept natural scroll smoothness in browser.

I'd suggest you to set your body's background color to the exact bg color of your nav bar to make it less obvious

Moorthy G
  • 1,441
  • 8
  • 9
0

I fixed the problem by removing my js function. On desktop navbar will not be fixed, on mobile the navbar is now directly fixed, and it works