2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-17 19:21:23 +03:00

Merge branch '3.0.0-wip' of github.com:twbs/bootstrap into 3.0.0-wip

This commit is contained in:
Mark Otto
2013-07-29 12:29:22 -07:00
13 changed files with 35 additions and 30 deletions
+5 -6
View File
@@ -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