Navbar scrollbar does not appear in another width

4

I used the code below to change when the menu button for mobile was displayed and worked, but the scroll bar does not appear in this size. What can I do to display the scroll bar? If need be I will put images.

@media (max-width: 991px) {
    .navbar-header {
        float: none;
    }
    .navbar-toggle {
        display: block;
    }
    .navbar-collapse {
        border-top: 1px solid transparent;
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
    }
    .navbar-collapse.collapse {
        display: none!important;
    }
    .navbar-collapse.collapse.in {
        display: block!important;
    }
    .navbar-nav {
        float: none!important;
        margin: 7.5px -15px;
    }
    .navbar-nav>li {
        float: none;
    }
    .navbar-nav>li>a {
        padding-top: 10px;
        padding-bottom: 10px;
    }
} 

UPDATED:

Fiddle: link

Images:

    
asked by anonymous 12.01.2017 / 13:21

2 answers

2

@media (max-width: 991px) {
  .navbar{
    overflow: auto;
  }
      
        .navbar-toggle {
            display: block;
        }
        .navbar-collapse {
            border-top: 1px solid transparent;
            box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
        }
        .navbar-collapse.collapse {
            display: none!important;
        }
        .navbar-collapse.collapse.in {
            display: block!important;
        }
        .navbar-nav {
            float: none!important;
            margin: 7.5px -15px;
            overflow: auto;
        }
        .navbar-nav>li {
            float: none;
        }
        .navbar-nav>li>a {
            padding-top: 10px;
            padding-bottom: 10px;
        }
    } 
<nav class="navbar navbar-default navbar-fixed-top">
    <div class="container">
      <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" style="padding: 0; padding-top: 10px" href="index.php"></a>
        </div>

        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav navbar-right">
                <li><a href="#">SOBRE</a></li>
                <li><a href="#">PRODUTOS</a></li>
                <li><a href="#">SERVIÇOS</a></li>
                <li><a href="#">TESTE</a></li>
                <li><a href="#">TESTE</a></li>
                <li><a href="#">TESTE</a></li>
                <li><a href="#">TESTE</a></li>
                <li><a href="#">TESTE</a></li>
                <li><a href="#">TESTE</a></li>
                <li><a href="#">TESTE</a></li>
                <li><a href="#">TESTE</a></li>
                <li><a href="#">TESTE</a></li>
                <li><a href="#">TESTE</a></li>
                <li><a href="#">TESTE</a></li>
                <li><a href="#">TESTE</a></li>
                <li><a href="#">TESTE</a></li>
                <li><a href="#">TESTE</a></li>
                <li><a href="#">TESTE</a></li>
                <li><a href="#">TESTE</a></li>
                <li><a href="#">TESTE</a></li>
                <li><a href="#">TESTE</a></li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">CONTEÚDOS</a>
                    <ul class="dropdown-menu">
                        <li><a href="#">DA PESQUISA À INOVAÇÃO</a></li>
                        <li><a href="#">IMPRENSA</a></li>
                        <li><a href="#">EXCLUSIVO</a></li>
                    </ul>
                </li>
              <li><a href="#">CONTATO</a></li>
            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>
    
12.01.2017 / 16:58
3

Generally to "force" the scroll bar is used overflow on the target. Example:

body {
  overflow-x: scroll; // somente para horizontal
  overflow-y: scroll; // somente para vertical
  overflow: scroll; // horizontal e vertical
}

Can be applied to specific elements too, such as div or styles.

Syntax:

  

overflow: visible | hidden | scroll | auto | initial | inherit;

    
12.01.2017 / 13:26