diff options
| author | Mark Otto <[email protected]> | 2013-07-26 19:26:58 -0700 |
|---|---|---|
| committer | Mark Otto <[email protected]> | 2013-07-26 19:26:58 -0700 |
| commit | e647d54f25439df4a6ebe3324f7ee81c504e84df (patch) | |
| tree | 658a43699e147c71214f643df80065f64711c378 /assets | |
| parent | 71acb0c42bd120c61e2943f3d794a0b8a905644d (diff) | |
| parent | 178d8e98deff6d3f69b7a8f89fc345d65b563670 (diff) | |
| download | bootstrap-e647d54f25439df4a6ebe3324f7ee81c504e84df.tar.xz bootstrap-e647d54f25439df4a6ebe3324f7ee81c504e84df.zip | |
Merge branch '3.0.0-wip' of github.com:twitter/bootstrap into 3.0.0-wip
Diffstat (limited to 'assets')
| -rw-r--r-- | assets/js/application.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/assets/js/application.js b/assets/js/application.js index 0435726c9..99ba1413d 100644 --- a/assets/js/application.js +++ b/assets/js/application.js @@ -8,11 +8,28 @@ var $window = $(window) + var navHeight = $('.navbar').outerHeight(true) + 10 + + $(document.body).scrollspy({ + target: '.bs-sidebar', + offset: navHeight + }) + // Disable certain links in docs $('.bs-docs-container [href=#]').click(function (e) { e.preventDefault() }) + $(document.body).on('click', '[href^=#]', function (e) { + + var $target = $(this.getAttribute('href')) + + e.preventDefault() // prevent browser scroll + + document.body.scrollTop = + $target.offset().top - + navHeight + 5 // offset scroll by nav + }) // back to top setTimeout(function () { |
