Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>HTML</strong> Don't affix the span3 (or span4 etc) DIV but a child of it; in my case I affixed #sidebar. Also you don't have to add .affix class or data-offset-top="XXX" to this div. The following Javascript will do the trick.</p> <pre><code> &lt;aside class="span3"&gt; &lt;div id="sidebar"&gt; &lt;p&gt;some content&lt;/p&gt; &lt;/div&gt; &lt;/aside&gt; </code></pre> <p><strong>CSS</strong> (the below code doesn't exist on bootstrap.css, I copied it from <a href="http://twitter.github.io/bootstrap/assets/css/docs.css" rel="nofollow noreferrer">http://twitter.github.io/bootstrap/assets/css/docs.css</a>)</p> <pre><code>.affix-bottom { position: absolute; top: auto; bottom: 400px; } </code></pre> <p><strong>Javacript</strong> the following js will change class of #sidebar from .affix to .affix-bottom according to how much page is scrolled</p> <pre><code> $('#sidebar').affix({ offset: { bottom: 450 } }); </code></pre> <p>Indeed on small resolutions #sidebar will overlap other elements. To solve this use bootstrap's media queries <a href="http://twitter.github.io/bootstrap/scaffolding.html#responsive" rel="nofollow noreferrer">http://twitter.github.io/bootstrap/scaffolding.html#responsive</a></p> <p>As <a href="https://stackoverflow.com/users/1684247/sara">Sara</a> previously pointed out, you can use something like..</p> <pre><code>@media(max-width:767px){ .affix { position: static; width: auto; top: 0; } } </code></pre> <p>..so that you make the #sidebar behave.</p> <p>Hope this helps somebody!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload