Commit cf670c41 authored by Liam's avatar Liam

Added js to allow sidebar links to jump to a anchor without being hidden my the header

parent 9085a5c4
......@@ -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