-1
A
回答
0
所以,
如果我理解你的问题,你希望用户开始滚动后,导航栏固定到顶部。那么,这里是我的这个实现...我用这个答案https://stackoverflow.com/a/21301875并修改它为这种情况以及记录的代码。
/**
* Scroll management
*/
$(document).ready(function() {
// Define the menu we are working with
var menu = $('.navbar.navbar-default.navbar-inverse');
// Get the menus current offset
var origOffsetY = menu.offset().top;
/**
* scroll
* Perform our menu mod
*/
function scroll() {
// Check the menus offset.
if ($(window).scrollTop() >= origOffsetY) {
//If it is indeed beyond the offset, affix it to the top.
$(menu).addClass('navbar-fixed-top');
} else {
// Otherwise, un affix it.
$(menu).removeClass('navbar-fixed-top');
}
}
// Anytime the document is scrolled act on it
document.onscroll = scroll;
});
+0
谢谢先生,我还可以在导航栏中使用css过渡吗? –
0
附加容器流体的3线
<div class="container-fluid">
在第5行
<nav class="navbar navbar-default navbar-inverse navbar-fixed-top" role="navigation">
添加导航栏固定顶部看到你的答案被覆盖存在的文件。 http://getbootstrap.com/components/#navbar
学英语如果打扰你
相关问题
- 1. 引导响应导航栏和填充到容器流体
- 2. 引导,容器,容器流体
- 3. 容器和容器流体的Bootstrap导航栏组合
- 4. Twitter引导程序:1侧栏1流体内容 - 容器
- 5. 导航栏和容器
- 6. 容器中的导航栏
- 7. 流体容器中的引导柱
- 8. 引导放置在容器流体
- 9. Bootstrap导航栏(随顶栏)锚标签导航导航栏后面的内容
- 10. 同步导航栏内容引导
- 11. 侧栏导航改为导航栏中的顶部导航栏
- 12. 导航栏和容器被折叠
- 13. 访问导航栏从容器视图
- 14. 将容器中的导航栏居中
- 15. 引导:内部导航栏
- 16. 带有动态字体大小调整和容器流体的Bootstrap导航栏?
- 17. Android导航栏顶部
- 18. 第二导航栏顶部
- 19. 禁用顶部导航栏
- 20. 滚动顶部导航栏
- 21. CSS /引导容器
- 22. 引导排容器
- 23. 身体内容由导航栏吃
- 24. 引导栏内容
- 25. 锚定导航 - 目标div应始终位于容器顶部
- 26. 贴上的顶部导航栏覆盖锚的内容
- 27. W3 CSS W3-导航栏与W3-顶部隐藏页面内容
- 28. Bootstrap贴上导航栏---宽度超过容器和身体EDITED
- 29. Wordpress导航删除容器
- 30. 中心对齐引导栏中的导航栏内容
是它的事,他们将如何帮助你,如果他们不明白你的问题吗? – icemelt