mirror of
https://github.com/hugo-fixit/FixIt.git
synced 2026-08-24 15:28:57 +00:00
♻️ Refactor: refactor reading progress with css animation
This commit is contained in:
@@ -1171,7 +1171,6 @@ class FixIt {
|
||||
const ACCURACY = 20;
|
||||
const $fixedButtons = document.querySelector('.fixed-buttons');
|
||||
const $backToTop = document.querySelector('.back-to-top');
|
||||
const $readingProgressBar = document.querySelector('.reading-progress-bar');
|
||||
if (document.body.dataset.headerDesktop === 'auto') {
|
||||
$headers.push(document.getElementById('header-desktop'));
|
||||
}
|
||||
@@ -1204,9 +1203,6 @@ class FixIt {
|
||||
});
|
||||
const contentHeight = document.body.scrollHeight - window.innerHeight;
|
||||
const scrollPercent = Math.max(Math.min(100 * Math.max(this.newScrollTop, 0) / contentHeight, 100), 0);
|
||||
if ($readingProgressBar) {
|
||||
$readingProgressBar.style.setProperty('--progress', `${scrollPercent.toFixed(2)}%`);
|
||||
}
|
||||
// whether to show fixed buttons
|
||||
if ($fixedButtons) {
|
||||
if (scrollPercent > 1) {
|
||||
|
||||
Reference in New Issue
Block a user