<script> //TOC generation $('#toc').toc({ 'selectors': toclevel(), //elements to use as headings 'container': 'main', //element to find all selectors in 'smoothScrolling': true, //enable or disable smooth scrolling on click 'prefix': 'toc', //prefix for anchor tags and class names 'onHighlight': function(el) {}, //called when a new section is highlighted 'highlightOnScroll': true, //add class to heading that is currently in focus 'highlightOffset': 100, //offset to trigger the next headline 'anchorName': function(i, heading, prefix) { //custom function for anchor name return prefix+i; }, 'headerText': function(i, heading, $heading) { //custom function building the header-item text return $heading.text(); }, 'itemClass': function(i, heading, $heading, prefix) { // custom function for item class return $heading[0].tagName.toLowerCase(); } }); </script> <script> //TOC toggle animation $('#toggle').on('click', function(){ if( $('nav').is(':visible') ) { $('nav').animate({ 'left': '-353px' }, 'slow', function(){ $('nav').hide(); }); $('body').animate({ 'margin-left': '0' }, 'slow'); } else { $('nav').show(); $('nav').animate({ 'left': '0px' }, 'slow'); $('body').animate({ 'margin-left': '298px' }, 'slow'); } }); </script> <script> // Scroll to top button window.onscroll = function() {scrollFunction()}; function scrollFunction() { if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) { document.getElementById("myBtn").style.display = "block"; } else { document.getElementById("myBtn").style.display = "none"; } } // When the user clicks on the button, scroll to the top of the document function topFunction() { document.body.scrollTop = 0; document.documentElement.scrollTop = 0; } </script> <script> /* $(document).ready(function() { $('[id^=toc]').each(function () { var currentToc = $(this); var url = window.location.href; currentToc.wrap("<a href='" + url + "#" + currentToc.attr("id") + "' </a>"); }); }); */ </script>