如何在滚动div之后将引导导航栏固定到顶部? [英] How can I fix the bootstrap navbar to the top after a div was scrolled?
问题描述
我试图让我的navbar与引导出现在一个特定的div,称为A。 Diva位于每页的顶部,高度约为400像素。一旦用户滚动经过diva和滚动条,我想滚动条粘在上面。类似这样的: https://www.facebook.com/home ,但我没有顶部的视频,它是一个图像。
I am trying to get my navbar with bootstrap to appear after a certain div, called "A". Div "a" is at the top of by page, and has a height of around 400px. Once the user scrolls past the div "a" and the scrollbar, I want the scroll bar to stick to the top. Similar to something like this: https://www.facebook.com/home but I don't have a video at the top, it is an image.
我们可以自己创建自己吗?
Can we do that we bootstrap itself?
谢谢!
推荐答案
我写了一个jQuery插件来做这个 - http://drewdahlman.github.com/Pinned/
I wrote a jQuery plugin for doing this - http://drewdahlman.github.com/Pinned/
超级简单 - 只需将标题位置设为绝对位置,然后设置up the jQuery plugin -
Super simple - just make your header position absolute and position it - then set up the jQuery plugin -
$("#element").pinned({
bounds: 100, // when to become sticky 100px
scrolling: 0, // position during scroll 0px
});
这应该可以!
!
这篇关于如何在滚动div之后将引导导航栏固定到顶部?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!