Skip to content

Commit

Permalink
Fix scroll-margin for anchors and sticky top
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanw committed Oct 31, 2023
1 parent cfd9887 commit 505811e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion fragdenstaat_de/fds_cms/templates/cms/pub_base.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
</div>
{% endif %}
<div class="bg-body col-md-10 col-lg-8 order-md-last mt-3 mb-3 ">
<div id="content" class="py-3 px-1 py-md-5 px-md-5">
<div id="content" class="book-pub-content py-3 px-1 py-md-5 px-md-5">
{% block app_body %}
{% placeholder "content" %}
{% endblock %}
Expand Down
3 changes: 1 addition & 2 deletions frontend/javascript/bookpub.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ function generateSubToc(level, headings, start = 1) {

function setupScrollSpy(content, toc) {
new ScrollSpy(content, {
target: toc,
smoothScroll: true
target: toc
})
}

Expand Down
8 changes: 7 additions & 1 deletion frontend/styles/bookpub.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,17 @@

@include media-breakpoint-up(lg) {
.toc {
max-height: 90vh;
max-height: calc(100vh - 60px);
overflow-y: scroll;
}
}

.book-pub-content {
[id] {
scroll-margin-top: 60px;
}
}

.footnotes li:target p {
color: var(--froide-highlight-color);
background-color: var(--froide-highlight-bg);
Expand Down

0 comments on commit 505811e

Please sign in to comment.