🚀 fix: tocbot warning

This commit is contained in:
shenyu 2020-03-24 21:57:41 +08:00
parent 085292ac1d
commit c1cedb6104

View File

@ -17,7 +17,7 @@
</script> </script>
<% } %> <% } %>
<% if (theme.toc && is_post()){ %> <% if (theme.toc && is_post() && !page.no_toc){ %>
<%- js('/js/tocbot.min') %> <%- js('/js/tocbot.min') %>
<script> <script>
// Tocbot_v4.7.0 http://tscanlin.github.io/tocbot/ // Tocbot_v4.7.0 http://tscanlin.github.io/tocbot/
@ -30,13 +30,7 @@
scrollContainer: 'main', scrollContainer: 'main',
positionFixedSelector: '.tocbot', positionFixedSelector: '.tocbot',
positionFixedClass: 'is-position-fixed', positionFixedClass: 'is-position-fixed',
fixedSidebarOffset: 'auto', fixedSidebarOffset: 'auto'
onClick: (e) => {
$('.toc-link').removeClass('is-active-link');
$(`a[href=${e.target.hash}]`).addClass('is-active-link');
$(e.target.hash).scrollIntoView();
return false;
}
}); });
</script> </script>
<% } %> <% } %>