Commit 0a98599b authored by Kristina Hoeppner's avatar Kristina Hoeppner

Added js to allow sidebar links to jump to an anchor without being hidden by the header

See merge request !4
parents 9085a5c4 cf670c41
......@@ -249,6 +249,30 @@
<noscript><p><img src="//www.catalyst-analytics.nz/piwik.php?idsite=5" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
<script type="text/javascript">
/**
* Offset html anchors for fixed header
*/
jQuery(function($) {
$(document).on('click', 'a', function(event) {
if ($(this.hash).length && location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '')) {
event.preventDefault();
var target = $(this.hash);
var headerheight = 0;
if ($('#navbar-top').length) {
headerheight = $('#navbar-top').height();
}
else if ($('.container-fluid').length) {
headerheight = $('.container-fluid').offset().top;
}
$('html, body').animate({
scrollTop: (target.offset().top - (headerheight * 2))
}, 500);
}
});
});
</script>
{% endblock %}
</head>
<body role="document">
......
Markdown is supported
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