Bootstrap: Affix - data-offset-bottom break affix when scrolled to the bottom

Created on 10 Mar 2015  Â·  7Comments  Â·  Source: twbs/bootstrap

Fiddle: http://jsfiddle.net/stefek99/0o15homy/

Demo: http://youtu.be/4XAKdwazxFo (less than a minute)

I've noticed couple of existing Affix issues, not sure if mine is a duplicate.

docs

Most helpful comment

I made a work around

$("[data-offset-top]").on("affixed.bs.affix",function () {
  $(this).removeAttr("style");
});

http://jsfiddle.net/983vjtn8/2/

All 7 comments

http://jsfiddle.net/0o15homy/1/ - here without bug, enjoy.

You have a data-offset-bottom attribute set.

From the documentation:

If a bottom offset is defined, scrolling past it should replace .affix with .affix-bottom. Since offsets are optional, setting one requires you to set the appropriate CSS. In this case, add position: absolute; when necessary. The plugin uses the data attribute or JavaScript option to determine where to position the element from there.

That said, the docs could clarify this a bit better if data-offset-bottom is going to be set in the example code.

HMMM...

I was hoping that:

  • if I scroll down and pass certain threshold the sidebar is fixed
  • if sidebar is larger than screen size it will be fixed to the bottom

(I'll try to figure it out)

Yeah this plugin is a bit confusing – i really effed up on the api for this plugin, that's my bad.

Expect a better solution for v4

Punt on this until then @fat?

yep

I made a work around

$("[data-offset-top]").on("affixed.bs.affix",function () {
  $(this).removeAttr("style");
});

http://jsfiddle.net/983vjtn8/2/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eddywashere picture eddywashere  Â·  3Comments

athimannil picture athimannil  Â·  3Comments

tiendq picture tiendq  Â·  3Comments

kamov picture kamov  Â·  3Comments

ghost picture ghost  Â·  3Comments