mirror of
https://github.com/CaiJimmy/hugo-theme-stack.git
synced 2025-04-29 12:03:31 +08:00
feat(sidebar): use HC-Sticky plugin
https://github.com/somewebmedia/hc-sticky/
This commit is contained in:
parent
ece300763d
commit
8242a0bafc
@ -74,3 +74,4 @@ Your support is greatly appreciated :)
|
|||||||
- [MunifTanjim/minimo](https://github.com/MunifTanjim/minimo)
|
- [MunifTanjim/minimo](https://github.com/MunifTanjim/minimo)
|
||||||
- [lepture/yue.css](https://github.com/lepture/yue.css)
|
- [lepture/yue.css](https://github.com/lepture/yue.css)
|
||||||
- Markdown gallery syntax from [Typlog](https://typlog.com/)
|
- Markdown gallery syntax from [Typlog](https://typlog.com/)
|
||||||
|
- [somewebmedia/hc-sticky](https://github.com/somewebmedia/hc-sticky)
|
||||||
|
@ -39,7 +39,6 @@
|
|||||||
.right-sidebar {
|
.right-sidebar {
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
display: none;
|
display: none;
|
||||||
height: 100vh;
|
|
||||||
|
|
||||||
&.sticky {
|
&.sticky {
|
||||||
top: 0;
|
top: 0;
|
||||||
@ -50,6 +49,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// For HC Sticky plugin, since it doesn't provide a option to customize class name
|
||||||
|
.sticky-spacer {
|
||||||
|
max-width: var(--right-sidebar-max-width);
|
||||||
|
}
|
||||||
|
|
||||||
.site-info {
|
.site-info {
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
transition: box-shadow 0.5s ease;
|
transition: box-shadow 0.5s ease;
|
||||||
|
@ -37,8 +37,8 @@ KaTeX:
|
|||||||
type: script
|
type: script
|
||||||
defer: true
|
defer: true
|
||||||
|
|
||||||
StickyScroller:
|
HCSticky:
|
||||||
- src: https://cdn.jsdelivr.net/npm/sticky-scroller@0.4.0/dist/sticky-scroller.js
|
- src: https://cdn.jsdelivr.net/npm/hc-sticky@2.2.7/dist/hc-sticky.js
|
||||||
integrity: sha256-OrppYVDkQVJpB/pb96X+9JStPPGpgHWhheQbgKy5EPI=
|
integrity: sha256-ZQb/nC8ArgZEjGauwabpmi57wvKmjsuXZbFcIKw4G/Y=
|
||||||
type: script
|
type: script
|
||||||
defer: true
|
defer: true
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
{{- partial "helper/external" (dict "Context" . "Namespace" "Vibrant") -}}
|
{{- partial "helper/external" (dict "Context" . "Namespace" "Vibrant") -}}
|
||||||
|
|
||||||
{{- partial "helper/external" (dict "Context" . "Namespace" "StickyScroller") -}}
|
{{- partial "helper/external" (dict "Context" . "Namespace" "HCSticky") -}}
|
||||||
<script>
|
<script>
|
||||||
window.addEventListener("load", () => {
|
window.addEventListener("load", () => {
|
||||||
const rightSiderbar = document.querySelector(".right-sidebar");
|
const rightSiderbar = document.querySelector(".right-sidebar");
|
||||||
if (rightSiderbar) new StickyScroller(rightSiderbar);
|
if (rightSiderbar) {
|
||||||
|
new hcSticky(".right-sidebar", {
|
||||||
|
stickTo: '.main-container',
|
||||||
|
stickyClass: 'js-sticked'
|
||||||
|
});
|
||||||
|
}
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user