diff options
| author | Jacob Thornton <[email protected]> | 2013-07-28 22:23:20 -0700 |
|---|---|---|
| committer | Jacob Thornton <[email protected]> | 2013-07-28 22:23:20 -0700 |
| commit | edaeb338168e99548e94e59d2d8ed43b95144d7d (patch) | |
| tree | 8e4b30b57a2bc8bcd82e6a1b2a25321b58a0a9aa | |
| parent | a31c5cea422b858f546529009723c4d33dd0d0ea (diff) | |
| download | bootstrap-edaeb338168e99548e94e59d2d8ed43b95144d7d.tar.xz bootstrap-edaeb338168e99548e94e59d2d8ed43b95144d7d.zip | |
fixed #8715
| -rw-r--r-- | assets/js/application.js | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/assets/js/application.js b/assets/js/application.js index bff00fc33..54f9455f7 100644 --- a/assets/js/application.js +++ b/assets/js/application.js @@ -7,10 +7,11 @@ $(function(){ var $window = $(window) + var $body = $(document.body) var navHeight = $('.navbar').outerHeight(true) + 10 - $(document.body).scrollspy({ + $body.scrollspy({ target: '.bs-sidebar', offset: navHeight }) @@ -19,14 +20,12 @@ e.preventDefault() }) - $(document.body).on('click', '.bs-sidenav [href^=#]', function (e) { + $body.on('click', '.bs-sidenav [href^=#]', function (e) { var $target = $(this.getAttribute('href')) - // e.preventDefault() // prevent browser scroll + e.preventDefault() // prevent browser scroll - document.body.scrollTop = - $target.offset().top - - navHeight + 5 // offset scroll by nav + $window.scrollTop($target.offset().top - navHeight + 5) }) // back to top |
