diff options
| author | fat <[email protected]> | 2013-07-26 19:25:45 -0700 |
|---|---|---|
| committer | fat <[email protected]> | 2013-07-26 19:25:45 -0700 |
| commit | 178d8e98deff6d3f69b7a8f89fc345d65b563670 (patch) | |
| tree | 888d4ec3dbdc0df5df242b9dbfd7f5139820ea1b /assets | |
| parent | bdac42ea40d2140d57d3272d5170b0943f9e7ebe (diff) | |
| download | bootstrap-178d8e98deff6d3f69b7a8f89fc345d65b563670.tar.xz bootstrap-178d8e98deff6d3f69b7a8f89fc345d65b563670.zip | |
update docs nav targets
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 () { |
