<script type="text/javascript">
$('a[href*="#"]:not([href="#"])').click(function() {
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(20) + ']');
if (target.length) {
$('html, body').animate({
scrollTop: target.offset().top - 20
}, 1000);
return false;
}
}
});
</script>
<script type="text/javascript">
jQuery(document).ready(function () {
var offset = $('#toc-widget-2').offset();
var topPadding = 0;
$(window).scroll(function() {
fixSide();
});
});
$(window).on('load' function() {
var offset = $('#toc-widget-2').offset();
var topPadding = 0;
fixSide();
});
function fixSide() {
if ($(window).scrollTop() > offset.top) {
$('#toc-widget-2').stop().css({marginTop: $(window).scrollTop() - offset.top + topPadding});
}
else {
$('#toc-widget-2').stop().css({marginTop: 20});
}
}
</script>