0

I am using Bootstrap 3 Affix feature, But cannot figure out how the data-offset-bottom works actually.

I have a potentially long main column, and a smaller one which contains an affixed nav.

My problem is that the affixed nav might be too long for some screen sizes, so I would like the user to be able to see the current item when scrolling down, which kind of works, even if I have to tweak the data-offset-bottom I guess ;

However, when you scrolls up from the bottom, the affix "disappear", because it gets a position: relative; from any JS code (I guess, from Bootstrap), which I would like to avoid.

Any idea about it ? Should I replace the fixed values of data-attributes by a function which would dynamically reset the offset depending of the scroll ? It does not seem to be the cleanest way to solve it.

http://jsfiddle.net/FloSchieldBobby/oz6nq6tL/

To see what I am talking about, just scroll completely down, then scrolls up again.

Flo Schild
  • 5,104
  • 4
  • 40
  • 55

1 Answers1

1

Not sure if you ever figured this out but I ran into the same problem today. When you apply data-offset-bottom it applies the class affix-bottom. All you need to do is add the following line to your css:

.affix-bottom{
position: absolute
}
jjoshua
  • 28
  • 1
  • 3
  • It seems better, however if the affix element is taller than the window height, when you scroll down a bit (untill chapter 13/14 for instance), the affix does not follow this scroll, untill you arrive at the bottom. Do you know why ? – Flo Schild Jun 23 '15 at 22:36
  • Not sure without seeing it in action.. I'm no wizard when it comes to some of these bootstrap components. It may have something do with the offsets defined. If you post an updated example it might help to see what you are talking about. – jjoshua Jun 24 '15 at 16:56
  • Indeed, I should have updated it: http://jsfiddle.net/FloSchieldBobby/oz6nq6tL/2/ I actually figured out: this is not a bug, Bootstrap's doc has the same behaviour, except their affix element is limited in height. Thanks a lot, I'll try to improve it by myself. – Flo Schild Jun 25 '15 at 12:33