0

hello all i have a bootstrap Affix , The broblem is the #sideBarContainer is take the rop class perfect , and when i scroll the class change to Affix perfect too , but when i arrive to the point that i need it to stop and change the class to bottom-affix , not stop :( why ??

$('#sideBarContainer').affix({
  offset: {
    top: 100,
    bottom: 200,

  }
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="sideBarContainer">
  <div class="ReadHeaderSections">
    <p></p>
  </div>
</div>
Mo.
  • 26,306
  • 36
  • 159
  • 225
Mohamed Samy
  • 931
  • 2
  • 13
  • 24

2 Answers2

2

From the docs:

If a bottom offset is defined, scrolling past that 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.

CSS (or Less):

.affix-bottom {
    position: absolute;
}
Bass Jobsen
  • 48,736
  • 16
  • 143
  • 224
0

This will not work with the coma after the last element in a query

bottom: 200,

instead use

bottom: 200