固定浏览导航栏菜单

时间:2019-01-29 12:53:20

标签: css twitter-bootstrap

我有此代码(这是引导程序固定的导航栏菜单):

 q) f:{[l;w;i]sum w*l i+til 4} / w- weight, l- input list, i-current index
 q) f[x;-3 -1 1 3]@'til count x

当我的宽度为480px时,我无法在菜单中滚动(在菜单中单击“ gabinet”之后-打开子菜单后)。在桌面分辨率下,我没有任何问题。

屏幕出现我的问题: https://imgur.com/a/bRJrIWh

有人知道如何解决吗?该网站使用Bootstrap 3

1 个答案:

答案 0 :(得分:2)

max-height是在引导程序中指定的,因此您需要通过在CSS下面添加来覆盖它

.navbar-fixed-bottom .navbar-collapse, .navbar-fixed-top .navbar-collapse {
    max-height: 100% !important;
}

实时片段

.navbar_odstep {
		padding-top: 50px;
		padding-bottom: 40px;
	}


	/*menu top*/

	.navbar-default .navbar-nav > li > a {
		color: white;
	}

	.navbar-default .navbar-nav > li > a:hover {
		color: white;
	}

	.navbar-default .navbar-nav > li > a:focus {
		color: white;
	}

	.navbar-default .navbar-nav > .open > a,
	.navbar-default .navbar-nav > .open > a:focus,
	.navbar-default .navbar-nav > .open > a:hover {
		background-color: transparent !important;
		color: white !important;
	}

	.navbar-default .navbar-nav .open .dropdown-menu > li > a:focus,
	.navbar-default .navbar-nav .open .dropdown-menu > li > a:hover {
		background-color: #4B617F !important;
		color: white !important;
	}

	.navbar-default .navbar-nav .open .dropdown-menu > li > a {
		background-color: #4B617F !important;
		color: white !important;
	}

	.navbar-default .navbar-collapse,
	.navbar-default .navbar-form {
		border-color: #3C4052;

	}

	.dropdown-menu {
		background-color: #4B617F !important;
	}



	.navbar-default .navbar-collapse,
	.navbar-default .navbar-form {
		border-color: #3C4052;
	}

	.navbar-default {
		background-color: #3C4052;
		border-color: #3C4052;
	}

	.dropdownSelector {
		padding-top: 0px !important;
		position: relative;
		top: -4px;
		text-align: center;
	}

	.navbar_cor_1 {
		-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
		filter: alpha(opacity=1);
		-moz-opacity: 1;
		-khtml-opacity: 1;
		opacity: 1;
	}



	.mopy_menu_1 {
		text-transform: uppercase;
		font-size: 16px;
		font-weight: normal;
	}

	.mopy_menu_dropdown {
		text-transform: none;
		font-size: 16px;
		font-weight: lighter;
	}

	.dropdownPadding {
		padding-top: 20px;
		padding-bottom: 20px;
	}

	.navbar-fixed-bottom .navbar-collapse, .navbar-fixed-top .navbar-collapse {
		max-height: 100% !important;
	}


	@media screen and (min-width: 1800px) {
		.container_mop{
			width: 1750px;
			background-color: black;
		}
		.dropdown-menu:before {
			position: absolute;
			top: -17px;
			left: 10%;
			display: inline-block;
			border-right: 27px solid transparent;
			border-bottom: 17px solid #ccc;
			border-left: 27px solid transparent;
			border-bottom-color: rgba(0, 0, 0, 0.2);
			content: '';
		}

		.dropdown-menu:after {
			position: absolute;
			top: -16px;
			left: 10%;
			display: inline-block;
			border-right: 26px solid transparent;
			border-bottom: 16px solid #4B617F;
			border-left: 26px solid transparent;
			content: '';
		}
	}

	@media(min-width: 1700px) and (max-width: 1799px) {
		.container_mop{
			width: 1700px;
			background-color: red;
		}
	}


	@media(max-width: 480px) {

		.odstepNadMenuFront {
			background-color: red;
			height: 120px;
		}

		.logo_top {
			padding-top: 50px;
			width: 90%;
		}

		.navbar_odstep {
			padding-top: 50px;
			padding-bottom: 0px;
		}

		.navbar_odstep{
			padding:0 ;
		}

	}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
  <div class="container-fluid container_mop">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse-1">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>

    </div>
    <a class="navbar-brand" href="#"><img src="images/logo.png" class="center img-responsive logo_top"></a>
    <div class="collapse navbar-collapse" id="navbar-collapse-1">

      <ul class="nav navbar-nav navbar-left navbar_odstep">
        <li class="mopy_menu_1"><a href="#">O mnie</a></li>
        <li class=" mopy_menu_1 dropdown ">
          <a href="#" class="mopy_menu_2 navbar_cor_1" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">gabinet <span class="caret"></span></a>
          <ul class="dropdown-menu dropdownPadding">
            <li class=" mopy_menu_dropdown"><a href="#">- Gdzie przyjmuje </a></li>
            <li class=" mopy_menu_dropdown"><a href="#">- Badania </a></li>
            <li class=" mopy_menu_dropdown"><a href="#">- Zabiegi</a></li>
            <li class=" mopy_menu_dropdown"><a href="#">- Przygotowanie </a></li>
          </ul>
        </li>

        <li class="mopy_menu_1"><a href="#">Usługi</a></li>
        <li class="mopy_menu_1"><a href="#">Cennik</a></li>
        <li class="mopy_menu_1"><a href="#">Artykuły</a></li>
      </ul>
      <ul class="nav navbar-nav navbar-right navbar_odstep">
        <li class="mopy_menu_1"><a href="#">Kontakt</a></li>
      </ul>
    </div>
  </div>
</nav>

<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>