feat: replace smooth scroll js with css scroll-behavior

This commit is contained in:
Dillon
2022-05-12 04:03:44 +08:00
parent 0960a266c7
commit 5e9c5f6417
14 changed files with 9 additions and 48 deletions

View File

@@ -5,6 +5,12 @@ html {
font-size: $global-font-size;
line-height: $global-line-height;
width:100%;
scroll-behavior: smooth;
main [id] {
scroll-margin-top: $header-height + .5rem;
}
}
/* scrollbar, only support webkit */

View File

@@ -40,6 +40,8 @@ code, pre, .highlight table, .highlight tr, .highlight td {
.highlight {
font-family: $code-font-family;
font-size: $code-font-size;
line-height: 1.4em;
margin: .5rem 0;
.table-wrapper {
> table,
@@ -55,11 +57,6 @@ code, pre, .highlight table, .highlight tr, .highlight td {
}
}
}
}
.highlight {
line-height: 1.4em;
margin: .5rem 0;
> .chroma {
position: relative;

View File

@@ -9,8 +9,6 @@ libFiles:
fontawesomeFreeCSS: '@fortawesome/fontawesome-free@6.1.1/css/all.min.css'
# animate.css@4.1.1 https://github.com/daneden/animate.css
animateCSS: animate.css@4.1.1/animate.min.css
# smooth-scroll@16.1.3 https://github.com/cferdinandi/smooth-scroll
smoothScrollJS: smooth-scroll@16.1.3/dist/smooth-scroll.min.js
# autocomplete.js@0.38.1 https://github.com/algolia/autocomplete.js
autocompleteJS: autocomplete.js@0.38.1/dist/autocomplete.min.js
# lunr.js@2.3.9 https://lunrjs.com/

View File

@@ -4,10 +4,6 @@ theme:
- Promise
- fetch
- Element.prototype.after
smooth-scroll:
- Element.prototype.closest
- requestAnimationFrame
- CustomEvent
algoliasearch:
- Promise
- Object.entries

View File

@@ -855,16 +855,6 @@ var Theme = /*#__PURE__*/function () {
}
}
}
}, {
key: "initSmoothScroll",
value: function initSmoothScroll() {
if (SmoothScroll) new SmoothScroll('[href^="#"]', {
speed: 300,
speedAsDuration: true,
header: '#header-desktop',
offset: 10
});
}
}, {
key: "initCookieconsent",
value: function initCookieconsent() {
@@ -1017,7 +1007,6 @@ var Theme = /*#__PURE__*/function () {
this.initHighlight();
this.initTable();
this.initHeaderLink();
this.initSmoothScroll();
this.initMath();
this.initMermaid();
this.initEcharts();

View File

@@ -2,7 +2,6 @@ normalize.css@8.0.1 https://github.com/necolas/normalize.css
fontawesome-free@6.1.1 https://fontawesome.com/
simple-icons@6.20.0 https://github.com/simple-icons/simple-icons
animate.css@4.1.1 https://github.com/daneden/animate.css
smooth-scroll@16.1.3 https://github.com/cferdinandi/smooth-scroll
autocomplete@0.38.1 https://github.com/algolia/autocomplete
lunr.js@2.3.9 https://lunrjs.com/
algoliasearch@4.13.0 https://github.com/algolia/algoliasearch-client-javascript

File diff suppressed because one or more lines are too long