Skip to content

Commit

Permalink
Add ToC scroolbar for huge articles
Browse files Browse the repository at this point in the history
Signed-off-by: GitHub Action <[email protected]>
  • Loading branch information
actions-user committed Nov 21, 2024
1 parent 881a5b1 commit 8f91272
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 2 deletions.
1 change: 1 addition & 0 deletions assets/scss/_colors.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ $highlight-grey: #7d828a !default;
$midnightblue: #2c3e50 !default;
$typewriter: hsl(172, 100%, 36%) !default;
$codebackground: #272822 !default;
$pagescrollbar-thumb: hsl(0, 0%, 53%) !default;

// Scroll to Top Default colors
$stt-stroke: #ccc !default;
Expand Down
32 changes: 32 additions & 0 deletions assets/scss/_scrolltotop.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.scroll-up {
.scroll {
#st-ring {
stroke: $stt-stroke;
}

#st-circle {
fill: $stt-circle;
}

#st-arrow {
fill: $stt-arrow;
}
}

position: fixed;
bottom: 10%;
right: 2%;
z-index: 1;
opacity: 0;
transition: all 0.5s ease;
}

.hide {
opacity: 0;
transform: translateY(20px);
}

.show {
opacity: 1;
transform: translateY(0);
}
29 changes: 27 additions & 2 deletions assets/scss/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{{ if ne false .Site.Params.usesAnimation }}
@import "animate.scss";
{{ end }}
@import "scroll.scss";
@import "scrolltotop.scss";
@import "socialshare.scss";
{{ if (fileExists "assets/scss/userstyles.scss") }}
@import "userstyles.scss";
Expand All @@ -27,7 +27,7 @@
}

::-webkit-scrollbar-thumb {
background: #888;
background: $pagescrollbar-thumb;

&:hover {
background: $text;
Expand Down Expand Up @@ -251,6 +251,7 @@ table {
box-shadow: -1px -2px 3px rgba(0, 0, 0, 0.45);
background-color: $dark-grey;
animation-duration: .3s;
animation-fill-mode: forwards;
}

.hdr-wrapper {
Expand Down Expand Up @@ -755,11 +756,35 @@ a.footnote-ref {

ul {
padding-left: 1em;
padding-right: 1em;
margin: 0;
}

/* scrollbar customization for ToC */
/* Width */
&>::-webkit-scrollbar {
width: 4px;
}

/* Track */
&>::-webkit-scrollbar-track {
background: darken($pagescrollbar-thumb, 10%);
}

/* Handle */
&>::-webkit-scrollbar-thumb {
background: $midnightblue ;
}

/* Handle on hover */
&>::-webkit-scrollbar-thumb:hover {
background: lighten($midnightblue, 10%);
}

&>ul {
list-style-type: none;
overflow-y: auto;
height: calc(100vh - 300px);

ul ul {
font-size: .9em;
Expand Down

0 comments on commit 8f91272

Please sign in to comment.