Correct scroll offset (#322)

* Remove heading padding
This commit is contained in:
2021-07-25 12:39:42 +08:00 committed by GitHub
parent 07097c8537
commit 368dc1d8ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 6 deletions

View File

@ -15,8 +15,6 @@
} }
h1, h2, h3, h4, h5, h6 { h1, h2, h3, h4, h5, h6 {
padding-top: 10px;
// Supported plugins: hexo-renderer-markdown-it hexo-renderer-marked // Supported plugins: hexo-renderer-markdown-it hexo-renderer-marked
.header-anchor, .headerlink { .header-anchor, .headerlink {
border-bottom-style: none; border-bottom-style: none;

View File

@ -27,7 +27,7 @@
.post-body { .post-body {
// For headers narrow width. // For headers narrow width.
h1, h2, h3, h4, h5, h6 { h1, h2, h3, h4, h5, h6 {
margin: 10px 0 8px; margin: 20px 0 8px;
} }
// Rewrite paddings & margins inside tags. // Rewrite paddings & margins inside tags.

View File

@ -34,7 +34,7 @@ h1, h2, h3, h4, h5, h6 {
font-family: $font-family-headings; font-family: $font-family-headings;
font-weight: bold; font-weight: bold;
line-height: 1.5; line-height: 1.5;
margin: 20px 0 15px; margin: 30px 0 15px;
} }
for $headline in (1 .. 6) { for $headline in (1 .. 6) {

View File

@ -181,7 +181,7 @@ NexT.utils = {
} }
if (!Array.isArray(NexT.utils.sections)) return; if (!Array.isArray(NexT.utils.sections)) return;
let index = NexT.utils.sections.findIndex(element => { let index = NexT.utils.sections.findIndex(element => {
return element && element.getBoundingClientRect().top > 0; return element && element.getBoundingClientRect().top > 10;
}); });
if (index === -1) { if (index === -1) {
index = NexT.utils.sections.length - 1; index = NexT.utils.sections.length - 1;
@ -275,7 +275,7 @@ NexT.utils = {
targets : document.scrollingElement, targets : document.scrollingElement,
duration : 500, duration : 500,
easing : 'linear', easing : 'linear',
scrollTop: offset + 10, scrollTop: offset,
complete : () => { complete : () => {
history.pushState(null, document.title, element.href); history.pushState(null, document.title, element.href);
} }