我使用的是Bootstrap documentation中使用的Bootstrap词缀侧边导航。正如你在这里看到的,当视图小于768px并且页面切换到移动视图时,scrollspy没有任何意义。因此,只要页面切换到mobile viewe,我就想停用scrollspy。请记住,修复应该只适用于侧边栏-导航-而不是导航栏。有谁有想法吗?
发布于 2013-07-03 20:06:51
修复非常简单。使用媒体查询并定义position:static;用于侧边栏-nav div用于移动视图,例如
@media (max-width: 767px){
.sidenav.affix { /* change sidenav selector to match your layout */
position: static; /* removes the affix behaviour */
width: auto; /* customise as required */
top: 0; /* customise as required */
}
}https://stackoverflow.com/questions/17447017
复制相似问题