Skip to content

Commit

Permalink
Navbar hides initial content when jumping to in-page anchor
Browse files Browse the repository at this point in the history
See twbs/bootstrap#1768 for details.
  • Loading branch information
pierre-rouanet committed Feb 6, 2014
1 parent 8b8660b commit 05ac605
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/sphinxjp/themes/basicstrap/templates/basicstrap/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,24 @@
}
});
});
$(window).load(function () {
/*
* Scroll the window to avoid the topnav bar
* https://github.com/twitter/bootstrap/issues/1768
*/
if ($(".navbar.navbar-fixed-top").length > 0) {
// var navHeight = $(".navbar").height(),
var navHeight = 40,
shiftWindow = function() { scrollBy(0, -navHeight - 10); };

if (location.hash) {
setTimeout(shiftWindow, 1);
}

window.addEventListener("hashchange", shiftWindow);
}
});
</script>
{%- endmacro %}

Expand Down

0 comments on commit 05ac605

Please sign in to comment.