Overflow scrolling not working on position fixed element iOS

ghost_dad

I have position: fixed navigation bar at the very bottom of a page on mobile devices / sizes. The nav bar itself has an overflow container where the user can scroll to the right to see additional links (this is a design request and in my opinion a poor user experience, but that's my 2 cents).

The issue I've been seeing when testing on iOS devices is that the scrolling / any link clicking is not available when the top / bottom native browser elements are not on screen. In other words, when those elements auto-hide, the fixed behavior does not work at all. I've created a fiddle below and also included a snippet of the pertinent code under that, in case there's any issues viewing the fiddle on iOS properly:

Fiddle showing the behavior in question

.sticky-nav {
  position: fixed;
  width: 100%;
  bottom: 0;
  left: 0;
  z-index: 90;
  background-color: #ddd;
  border-top: 1px solid #f8f8f8;
  overflow: hidden;
}

.sticky-nav-inner {
  display: -webkit-flex;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 90%;
  height: 57px;
  max-width: 1200px;
  margin: 0 auto;
  z-index: 0;
}

.sticky-nav-menu {
  display: inline-block;
  white-space: nowrap;
  padding-right: 25px;
  margin: 0;
}

.sticky-nav-menu li {
  display: inline-block;
  white-space: nowrap;
  margin-right: 25px;
  padding-top: 20px;
}

.sticky-nav-overflow {
  width: calc(100% - 100px);
  height: 100%;
  margin-right: 2%;
  overflow-x: scroll;
}

.sticky-nav-mobile {
  padding-left: 1%;
  z-index: 1;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="pane-container">
      <nav class="sticky-nav js-sticky-nav clearfix">
        <div class="sticky-nav-inner">
          <div class="sticky-nav-overflow">
            <ul role="tablist" class="sticky-nav-menu is-centered-text">
              <li role="presentation" class="active"><a href="#linkone" aria-controls="linkone" role="tab" data-toggle="tab" class="sticky-nav-link">LINK ONE</a></li>
              <li role="presentation"><a href="#linktwo" aria-controls="linktwo" role="tab" data-toggle="tab" class="sticky-nav-link">LINK TWO</a></li>
              <li role="presentation"><a href="#linkthree" aria-controls="linkthree" role="tab" data-toggle="tab" class="sticky-nav-link">LINK THREE</a></li>
              <li role="presentation" class="sticky-nav-animated-list"><a href="#linkfour" aria-controls="linkfour" role="tab" data-toggle="tab" class="sticky-nav-link">LINK FOUR</a></li>
            </ul>
          </div>
          <div class="sticky-nav-mobile">
            <a href="#" class="sticky-nav-cta call-button">BUY NOW</a>
          </div>
        </div>
      </nav>
      <div class="tab-content">
        <div id="linkone" role="tabpanel" class="grid-container grid-parent linkone-pane is-centered-text tab-pane fade in active">
          <h1>Link one pane</h1>
        </div>
        <div id="linktwo" role="tab-panel" class="grid-container grid-parent linktwo-pane is-centered-text tab-pane fade">
          <h1>Link two pane</h1>
        </div>
        <div id="linkthree" role="tab-panel" class="grid-container grid-parent linkthree-pane is-centered-text tab-pane fade">
          <h1>Link three pane</h1>
        </div>
        <div id="linkfour" role="tab-panel" class="grid-container grid-parent linkfour-pane is-centered-text tab-pane fade">
          <h1>Link four pane</h1>
        </div>
      </div>
    </div>

I've tried some alternative methods, such as -webkit-overflow-scrolling with no luck. I have a feeling this issue is unrelated. Seems to not even register that area of the screen without being pushed up by the native bottom bar on iOS.

Any and all assistance is much appreciated. Just running out of ideas to try on my own. I'm hoping to accomplish this with a minimum of JavaScript, but I'm not at all opposed. Thanks for your help!

ghost_dad

Alright, I was able to resolve the issue (which is kind of a weird one). For some reason, having the nav fixed to the very bottom seemed to be the issue. To fix this, I added additional space using the bottom property and added a pseudo-element to fill in the gap. Then, increased the height of the link elements inside the scroll container. Here's the updated code:

.sticky-nav {
  position: fixed;
  width: 100%;
  padding-top: 10px;
  bottom: 10px;
  left: 0;
  z-index: 90;
  background-color: #ddd;
  border-top: 1px solid #f8f8f8;
}

.sticky-nav:after {
  content: "";
  position: absolute;
  width: 100%;
  height: 10px;
  bottom: -10px;
  left: 0;
  background-color: #ddd;
}

.sticky-nav-inner {
  display: -webkit-flex;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 90%;
  height: 57px;
  max-width: 1200px;
  margin: 0 auto;
  z-index: 0;
}

.sticky-nav-menu {
  display: inline-block;
  white-space: nowrap;
  height: 100%;
  padding-right: 25px;
  margin: 0;
}

.sticky-nav-menu li {
  display: inline-block;
  white-space: nowrap;
  height: 100%;
}

.sticky-nav-menu li a {
  display: inline-block;
  height: 100%;
  padding-top: 20px;
  padding-right: 25px;
}

.sticky-nav-overflow {
  width: calc(100% - 100px);
  height: 100%;
  margin-right: 2%;
  overflow-x: scroll;
}

.sticky-nav-mobile {
  padding-left: 1%;
  z-index: 1;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"/>
<div class="pane-container">
      <nav class="sticky-nav js-sticky-nav clearfix">
        <div class="sticky-nav-inner">
          <div class="sticky-nav-overflow">
            <ul role="tablist" class="sticky-nav-menu is-centered-text">
              <li role="presentation" class="active"><a href="#linkone" aria-controls="linkone" role="tab" data-toggle="tab" class="sticky-nav-link">LINK ONE</a></li>
              <li role="presentation"><a href="#linktwo" aria-controls="linktwo" role="tab" data-toggle="tab" class="sticky-nav-link">LINK TWO</a></li>
              <li role="presentation"><a href="#linkthree" aria-controls="linkthree" role="tab" data-toggle="tab" class="sticky-nav-link">LINK THREE</a></li>
              <li role="presentation" class="sticky-nav-animated-list"><a href="#linkfour" aria-controls="linkfour" role="tab" data-toggle="tab" class="sticky-nav-link">LINK FOUR</a></li>
            </ul>
          </div>
          <div class="sticky-nav-mobile">
            <a href="#" class="sticky-nav-cta call-button">BUY NOW</a>
          </div>
        </div>
      </nav>
      <div class="tab-content">
        <div id="linkone" role="tabpanel" class="grid-container grid-parent linkone-pane is-centered-text tab-pane fade in active">
          <h1>Link one pane</h1>
        </div>
        <div id="linktwo" role="tab-panel" class="grid-container grid-parent linktwo-pane is-centered-text tab-pane fade">
          <h1>Link two pane</h1>
        </div>
        <div id="linkthree" role="tab-panel" class="grid-container grid-parent linkthree-pane is-centered-text tab-pane fade">
          <h1>Link three pane</h1>
        </div>
        <div id="linkfour" role="tab-panel" class="grid-container grid-parent linkfour-pane is-centered-text tab-pane fade">
          <h1>Link four pane</h1>
        </div>
      </div>
    </div>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Position fixed sidebar with overflow scroll not scrolling to bottom

From Dev

Horizontal scrolling not working when position absolute/fixed

From Dev

Fixed position element is flashing in Chrome when scrolling

From Dev

How to Stop Jumping Position fixed element on scrolling

From Dev

How to Stop Jumping Position fixed element on scrolling

From Dev

Fixed position not working on ios devices

From Dev

Fixed position not working on ios devices

From Dev

Background scrolling behind position:fixed; on iOS

From Dev

Mobile web: -webkit-overflow-scrolling: touch conflicts with position:fixed

From Dev

iOS Safari issue - Element becomes invisible while scrolling when changing position absolute to fixed

From Dev

Position absolute but with fixed scrolling

From Dev

Stop jQuery fixed position scrolling when bottom of scrolling element reaches end of parent element

From Dev

Stop jQuery fixed position scrolling when bottom of scrolling element reaches end of parent element

From Dev

CSS - Overflow scrolling not working

From Dev

iOS momentum scrolling on scrollable div with fixed positioned child element

From Dev

Phonegap (Cordova) Scrolling with a data-position="fixed" header/footer only ios scrolling issue

From Dev

scrolling an element on top of a fixed element

From Dev

#sidebar position:fixed at certain scrolling

From Dev

z-index not working inside position fixed element

From Dev

z-index not working inside position fixed element

From Dev

Fixed Position not working in Chrome

From Dev

Fixed position not working for header

From Dev

Position: Fixed; Not working properly

From Dev

Position fixed not working on Tumblr

From Dev

Prevent overflow / rubberband scrolling on iOS

From Dev

Position a fixed element below another fixed element

From Dev

Child with position:fixed scrolls with position:fixed, overflow:auto parent

From Dev

Child with position:fixed scrolls with position:fixed, overflow:auto parent

From Dev

thead element and scrolling is not working

Related Related

  1. 1

    Position fixed sidebar with overflow scroll not scrolling to bottom

  2. 2

    Horizontal scrolling not working when position absolute/fixed

  3. 3

    Fixed position element is flashing in Chrome when scrolling

  4. 4

    How to Stop Jumping Position fixed element on scrolling

  5. 5

    How to Stop Jumping Position fixed element on scrolling

  6. 6

    Fixed position not working on ios devices

  7. 7

    Fixed position not working on ios devices

  8. 8

    Background scrolling behind position:fixed; on iOS

  9. 9

    Mobile web: -webkit-overflow-scrolling: touch conflicts with position:fixed

  10. 10

    iOS Safari issue - Element becomes invisible while scrolling when changing position absolute to fixed

  11. 11

    Position absolute but with fixed scrolling

  12. 12

    Stop jQuery fixed position scrolling when bottom of scrolling element reaches end of parent element

  13. 13

    Stop jQuery fixed position scrolling when bottom of scrolling element reaches end of parent element

  14. 14

    CSS - Overflow scrolling not working

  15. 15

    iOS momentum scrolling on scrollable div with fixed positioned child element

  16. 16

    Phonegap (Cordova) Scrolling with a data-position="fixed" header/footer only ios scrolling issue

  17. 17

    scrolling an element on top of a fixed element

  18. 18

    #sidebar position:fixed at certain scrolling

  19. 19

    z-index not working inside position fixed element

  20. 20

    z-index not working inside position fixed element

  21. 21

    Fixed Position not working in Chrome

  22. 22

    Fixed position not working for header

  23. 23

    Position: Fixed; Not working properly

  24. 24

    Position fixed not working on Tumblr

  25. 25

    Prevent overflow / rubberband scrolling on iOS

  26. 26

    Position a fixed element below another fixed element

  27. 27

    Child with position:fixed scrolls with position:fixed, overflow:auto parent

  28. 28

    Child with position:fixed scrolls with position:fixed, overflow:auto parent

  29. 29

    thead element and scrolling is not working

HotTag

Archive