admin管理员组文章数量:1434929
I have a Page in Rails which has 4-5 tabs. Each tab renders a partial (say a page). I want to be able to keep the tabs fixed on the screen at the top or some margin from the top, even though a user scrolls down. I have used Bootstrap's <ul class="nav nav-tabs">
for tabs.
I have a Page in Rails which has 4-5 tabs. Each tab renders a partial (say a page). I want to be able to keep the tabs fixed on the screen at the top or some margin from the top, even though a user scrolls down. I have used Bootstrap's <ul class="nav nav-tabs">
for tabs.
- stackoverflow./questions/23020763/… – mxr7350 Commented May 4, 2017 at 13:04
- I have already read it, and tried. The scrolling content overlaps the tabs. – the railslearner Commented May 4, 2017 at 13:06
2 Answers
Reset to default 2Add class navbar-fixed-top
to nav ul
@media
only screen and (your condition)
{
[class*="nav-tabs"]
{
position: fixed;
z-index: 9;
background-color: #fff;
margin-top: -11%; // adjust according to your need
}
// you are probably gonna mess up tab-content margin as well, so adjust it as I have shown below
[class*="tab-content"]
{
margin-top: 5%; // insert n% as per your need
}
}
本文标签: javascriptHow do I keep navtabs in boostrap fixed on the top while scrollingStack Overflow
版权声明:本文标题:javascript - How do I keep nav-tabs in boostrap fixed on the top while scrolling? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745624950a2666915.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论