bootstrap 移动菜单不滚动,而是背景在滚动
bootstrap mobile menu not scrolling instead the background is scrolling
我在 bootstrap 中完成了一个网站,菜单在桌面上运行良好
<button type="button" class="dropdown-toggle pull-left" data-toggle="dropdown" data-target="#navbar-menu" aria-expanded="true">
<i class="fa fa-bars"></i><span style="font-size: 10px;width:100%;float: left;"><b>menu</b></span>
</button>
现在,当我在移动设备上加载它并打开菜单时,它没有滚动,所以我无法在下拉列表中看到选项,而是背景在滚动,我搜索并在 [=35= 中看到了答案] 如下所示:
.navbar-nav {
height: 150vh; // <-- This will fix the collapse animation
}
.navbar-collapse.in {
overflow-x: hidden;
padding-right: 17px; // <-- Hide scroll bar, but still being able to scroll
}
@media (min-width: 768px) {
.navbar-nav {
height: auto;
}
}
但菜单仍然不滚动,背景在滚动。谁能告诉我这里可能出了什么问题,这是我的直播 url enter link description here
提前致谢
我终于解决了这个问题,我给了菜单高度和溢出滚动条
.navbar-nav {
max-height:400px;
overflow-y: scroll;
}
只需将 navbar-nav-scroll
class 添加到现有 navbar-nav
class,即可解决所有滚动问题。
我在 bootstrap 中完成了一个网站,菜单在桌面上运行良好
<button type="button" class="dropdown-toggle pull-left" data-toggle="dropdown" data-target="#navbar-menu" aria-expanded="true">
<i class="fa fa-bars"></i><span style="font-size: 10px;width:100%;float: left;"><b>menu</b></span>
</button>
现在,当我在移动设备上加载它并打开菜单时,它没有滚动,所以我无法在下拉列表中看到选项,而是背景在滚动,我搜索并在 [=35= 中看到了答案] 如下所示:
.navbar-nav {
height: 150vh; // <-- This will fix the collapse animation
}
.navbar-collapse.in {
overflow-x: hidden;
padding-right: 17px; // <-- Hide scroll bar, but still being able to scroll
}
@media (min-width: 768px) {
.navbar-nav {
height: auto;
}
}
但菜单仍然不滚动,背景在滚动。谁能告诉我这里可能出了什么问题,这是我的直播 url enter link description here
提前致谢
我终于解决了这个问题,我给了菜单高度和溢出滚动条
.navbar-nav {
max-height:400px;
overflow-y: scroll;
}
只需将 navbar-nav-scroll
class 添加到现有 navbar-nav
class,即可解决所有滚动问题。