Reputation: 119
When affixing a nav down the side of a page the content moves under the nav after initial scroll instead of staying along side, any ideas how to fix this?
Using:
data-spy="affix"
http://jsfiddle.net/cooltrooper/eJFaY/3/
Thanks
Upvotes: 1
Views: 2829
Reputation: 3190
I overcame this issue by adding CSS that applied to the element once the "affix"
class is applied.
#your_element_id .affix {
top: (enter the pixel number where you want your element to stick);
}
Another option is to skip the data-spy'affix'
. Attach the "affix"
class inline.
Hopefully that provides some insight.
Upvotes: 1
Reputation: 38543
I think you generally have to specify it to an element that doesn't have the span*
class.
It works better if you add it to the ul
:
<ul class="well nav nav-list" data-spy="affix" data-offset-top="100">
or
<ul class="well nav nav-list affix">
Upvotes: 4