diff --git a/static/src/js/app.js b/static/src/js/app.js index 0f26c54..4989903 100644 --- a/static/src/js/app.js +++ b/static/src/js/app.js @@ -61,16 +61,26 @@ $(document).ready(function() { }); }); -$('#scroll-top').on('click', function(event) { +function scrollTo(offset) { $('html, body') .stop() .animate( { - scrollTop: 0, + scrollTop: offset, }, 500 ); +} + +$('#scroll-top').on('click', function(event) { event.preventDefault(); + scrollTo(0); +}); + +$('#TableOfContents a').on('click', function(event) { + event.preventDefault(); + const target = $($(this).attr('href')); + scrollTo(target.offset().top); }); $('[data-clipboard-text]').on('click', function(event) {