Commit edaeb338 authored by Jacob Thornton's avatar Jacob Thornton
Browse files

fixed #8715

parent a31c5cea
Showing with 5 additions and 6 deletions
+5 -6
...@@ -7,10 +7,11 @@ ...@@ -7,10 +7,11 @@
$(function(){ $(function(){
var $window = $(window) var $window = $(window)
var $body = $(document.body)
var navHeight = $('.navbar').outerHeight(true) + 10 var navHeight = $('.navbar').outerHeight(true) + 10
$(document.body).scrollspy({ $body.scrollspy({
target: '.bs-sidebar', target: '.bs-sidebar',
offset: navHeight offset: navHeight
}) })
...@@ -19,14 +20,12 @@ ...@@ -19,14 +20,12 @@
e.preventDefault() e.preventDefault()
}) })
$(document.body).on('click', '.bs-sidenav [href^=#]', function (e) { $body.on('click', '.bs-sidenav [href^=#]', function (e) {
var $target = $(this.getAttribute('href')) var $target = $(this.getAttribute('href'))
// e.preventDefault() // prevent browser scroll e.preventDefault() // prevent browser scroll
document.body.scrollTop = $window.scrollTop($target.offset().top - navHeight + 5)
$target.offset().top -
navHeight + 5 // offset scroll by nav
}) })
// back to top // back to top
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment