mirror of
https://github.com/next-theme/hexo-theme-next.git
synced 2026-01-19 18:42:34 +00:00
New reversed reading progress bar option (#221)
This commit is contained in:
parent
9ef3a63552
commit
d46df43afe
@ -377,8 +377,11 @@ back2top:
|
|||||||
# Reading progress bar
|
# Reading progress bar
|
||||||
reading_progress:
|
reading_progress:
|
||||||
enable: false
|
enable: false
|
||||||
|
# Available values: left | right
|
||||||
|
startAt: left
|
||||||
# Available values: top | bottom
|
# Available values: top | bottom
|
||||||
position: top
|
position: top
|
||||||
|
reversed: false
|
||||||
color: "#37c6c0"
|
color: "#37c6c0"
|
||||||
height: 3px
|
height: 3px
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,22 @@
|
|||||||
.reading-progress-bar {
|
.reading-progress-bar {
|
||||||
|
--progress: 0;
|
||||||
background: unquote(hexo-config('reading_progress.color'));
|
background: unquote(hexo-config('reading_progress.color'));
|
||||||
height: unquote(hexo-config('reading_progress.height'));
|
height: unquote(hexo-config('reading_progress.height'));
|
||||||
left: 0;
|
|
||||||
position: fixed;
|
position: fixed;
|
||||||
width: 0;
|
|
||||||
z-index: $zindex-5;
|
z-index: $zindex-5;
|
||||||
|
|
||||||
|
if (hexo-config('reading_progress.reversed')) {
|
||||||
|
width: calc(100% - var(--progress));
|
||||||
|
} else {
|
||||||
|
width: var(--progress);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hexo-config('reading_progress.startAt') == 'right') {
|
||||||
|
right: 0;
|
||||||
|
} else {
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (hexo-config('reading_progress.position') == 'bottom') {
|
if (hexo-config('reading_progress.position') == 'bottom') {
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -161,7 +161,7 @@ NexT.utils = {
|
|||||||
backToTop.querySelector('span').innerText = Math.round(scrollPercent) + '%';
|
backToTop.querySelector('span').innerText = Math.round(scrollPercent) + '%';
|
||||||
}
|
}
|
||||||
if (readingProgressBar) {
|
if (readingProgressBar) {
|
||||||
readingProgressBar.style.width = scrollPercent.toFixed(2) + '%';
|
readingProgressBar.style.setProperty('--progress', scrollPercent.toFixed(2) + '%');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!Array.isArray(NexT.utils.sections)) return;
|
if (!Array.isArray(NexT.utils.sections)) return;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user