Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't initialize scrollspy when #toc element is missing #1998

Merged
merged 2 commits into from
Jan 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

* New Korean (`ko`) translation thanks to @mrchypark and @peremen (#1994).

* Fixed issues that occurred on pages without a table of contents (@gadenbuie, #1998).

# pkgdown 2.0.1

* Fix CRAN failures.
Expand Down
10 changes: 6 additions & 4 deletions inst/BS5/assets/pkgdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
$scope: $("main h2, main h3, main h4, main h5, main h6")
});

$('body').scrollspy({
target: '#toc',
offset: 56 // headroom height
});
if ($('#toc').length) {
$('body').scrollspy({
target: '#toc',
offset: 56 // headroom height
});
}

// Activate popovers
$('[data-bs-toggle="popover"]').popover({
Expand Down