'Bootstrap and jumping to Anchors
I'm building a quick VPS main page for my dev server using bootstrap ( still learning ). But I cant get the anchors to line up to the top. I searched 2 hours about using bootstrap and different plugins to get the same effect as: http://twitter.github.com/bootstrap/components.html
When you chose a menu item on the left the page automatically scrolles down. And the anchor is aligned to the top. I think this is done with jQuery but I can't figure out how. My links do jump to the anchors but just barely so that they are visible.
Can anyone tell me how this is achieved ?
Solution 1:[1]
Assuming you're using a fixed nav bar, you need to add the same padding-top you have in body (to accomodate the nav bar) to the element you're anchoring too.
I found this article that explained it quite well here: Fix bootstrap anchor tags position using fixed nav bars
Solution 2:[2]
I believe they are using the Affix plugin.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Laurel |
Solution 2 | stackless |