Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The sticky navbar you are refereing to is possible thanks to the affix plugin. You can <a href="http://getbootstrap.com/javascript/#affix">view the bootstrap documentation on this</a>. </p> <p>This <a href="http://jsfiddle.net/8ykJ8/">Jsfiddle</a> contains a working sticky sidebar (make the result window larger to see it work properly). Read on to create the same sidebar. </p> <p><b>1. Create html for your sidebar.</b> For this example we will use bootstraps nav-pills within a well. </p> <pre><code>&lt;div class="row"&gt; &lt;div class="col-sm-3"&gt; &lt;div class="well bs-sidebar affix" id="sidebar"&gt; &lt;ul class="nav nav-pills nav-stacked"&gt; &lt;li&gt;&lt;a href="#"&gt;Link 1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Link 2&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;!--well bs-sidebar affix--&gt; &lt;/div&gt; &lt;!--col-sm-3--&gt; &lt;div class="col-sm-9"&gt; &lt;p&gt;Main body content goes here&lt;/p&gt; &lt;/div&gt; &lt;!--col-sm-9--&gt; &lt;/div&gt; &lt;!--row--&gt; </code></pre> <p><b> 2. Invoke the affix plugin in your js file</b></p> <pre><code>$('#sidebar').affix({ offset: { top: $('header').height() } }); </code></pre> <p>You need to replace 'header' with whatever will be above the the sidebar. If you are using a bootstrap navbar and it is directly above the sidebar, replace 'header' with the class you are using for the navbar, for example: </p> <pre><code>top: $('.navbar navbar-default').height() </code></pre> <p><b>3. Add css for affix class</b></p> <p>CSS for non-responsive layout</p> <pre><code>.bs-sidebar.affix { width: 263px; top: 25px; } </code></pre> <p>CSS for responsive layout</p> <pre><code>@media (min-width: 768px) { .bs-sidebar.affix { width: 158px; top: 25px; } } @media (min-width: 992px) { .bs-sidebar.affix { width: 213px; position: fixed; top: 25px; } } @media (min-width: 1200px) { .bs-sidebar.affix { width: 263px; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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