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

Use scroll-margin-top instead of pseudo hack #30273

Merged
merged 4 commits into from Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 0 additions & 6 deletions site/assets/js/application.js
Expand Up @@ -167,11 +167,5 @@
}
anchors.add('.bd-content > h2, .bd-content > h3, .bd-content > h4, .bd-content > h5')

// Wrap inner
makeArray(document.querySelectorAll('.bd-content > h2, .bd-content > h3, .bd-content > h4, .bd-content > h5'))
.forEach(function (hEl) {
hEl.innerHTML = '<span class="bd-content-title">' + hEl.innerHTML + '</span>'
})

bsCustomFileInput.init()
})()
22 changes: 4 additions & 18 deletions site/assets/scss/_content.scss
Expand Up @@ -5,20 +5,11 @@
.bd-content {
order: 1;

// Hack the sticky header
// stylelint-disable selector-no-qualifying-type
> h2[id],
> h3[id],
> h4[id] {
pointer-events: none;

&::before {
display: block;
height: 6rem;
margin-top: -6rem;
content: "";
// Offset for the sticky header
> [id] {
@include media-breakpoint-up(md) {
scroll-margin-top: 4rem;
}
// stylelint-enable selector-no-qualifying-type
}

> h2:not(:first-child) {
Expand Down Expand Up @@ -66,11 +57,6 @@
}
}

.bd-content-title {
display: block;
pointer-events: auto;
}

.bd-title {
@include font-size(3rem);
}
Expand Down