-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The bootstrap-toc project is rather unmainted, Tocbot is the alternative recommended by the authors. Also see afeld/bootstrap-toc#74
- Loading branch information
1 parent
91522f7
commit 461d004
Showing
6 changed files
with
24 additions
and
21 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
document.addEventListener("DOMContentLoaded", () => { | ||
const selector = '#usersuite-sidebar-nav'; | ||
const $toc = $(selector); | ||
const $parent = $toc.parent(); | ||
const offset = 60; | ||
const $body = $('body'); | ||
Toc.init($toc); | ||
$body.scrollspy({target: selector, offset: offset}); | ||
$toc.affix({ | ||
offset: {top: () => $parent.offset().top - offset} | ||
}); | ||
// Handle window resize | ||
$(window).resize(() => $toc.affix('checkPosition')); | ||
tocbot.init({ | ||
// Where to render the table of contents. | ||
tocSelector: '.js-toc', | ||
// Where to grab the headings to build the table of contents. | ||
contentSelector: '.js-toc-content', | ||
// Which headings to grab inside of the contentSelector element. | ||
headingSelector: 'h2, h3', | ||
// For headings inside relative or absolute positioned containers within content. | ||
hasInnerContainers: true, | ||
|
||
positionFixedSelector: '#usersuite-sidebar-nav', | ||
extraLinkClasses: 'text-decoration-none' | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters