Bootstrapのサイドバー

http://twitter.github.com/bootstrap/getting-started.html

bootstrapの固定サイドバーは、「bootstrap-affix.js」で実装されている(version 2.1.1)

 https://github.com/twitter/bootstrap/blob/master/js/bootstrap-affix.js

 bootstrap-affix.jsでは、以前(version 2.0)のように、data-target 属性を見ていない

 サイドバーの処理は、application.js内で、affixメソッドを呼んで実装している。

 

    var $window = $(window)

    // side bar

    $('.bs-docs-sidenav').affix({

      offset: {

        top: function () { return $window.width() <= 980 ? 290 : 210 }

      , bottom: 270

      }

    })

 
サイドバーの位置は、上記のoffset ハッシュのtopのパラメータと、
docs.css の .bs-docs-sidenav.affix スタイルを調整する。
.bs-docs-sidenav.affix {
  top: 40px;
}