aboutsummaryrefslogtreecommitdiff
path: root/assets
diff options
context:
space:
mode:
Diffstat (limited to 'assets')
-rw-r--r--assets/js/application.js17
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 () {