Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,18 +580,21 @@ const ScrollProgress = {

update() {
if (this.isModalActive) return;
// ⚑ bolt: hoist global property access out of high-frequency loop
const scrollTop = window.scrollY;
const docHeight = this.cachedDocHeight - this.cachedWindowHeight;
const progress = docHeight > 0 ? (scrollTop / docHeight) * 100 : 0;
this.bar.style.width = `${Math.max(0, Math.min(100, progress))}%`;
const progress = docHeight > 0 ? (scrollTop / docHeight) : 0;
// ⚑ bolt: use GPU-accelerated transform instead of layout-inducing width
this.bar.style.transform = `scaleX(${Math.max(0, Math.min(1, progress))})`;
},

updateModal() {
if (!this.isModalActive || !this.modalContent) return;
const scrollTop = this.modalContent.scrollTop;
const scrollHeight = this.modalContent.scrollHeight - this.modalContent.clientHeight;
const progress = scrollHeight > 0 ? (scrollTop / scrollHeight) * 100 : 0;
this.bar.style.width = `${Math.max(0, Math.min(100, progress))}%`;
const progress = scrollHeight > 0 ? (scrollTop / scrollHeight) : 0;
// ⚑ bolt: use GPU-accelerated transform instead of layout-inducing width
this.bar.style.transform = `scaleX(${Math.max(0, Math.min(1, progress))})`;
}
};

Expand Down
7 changes: 5 additions & 2 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -594,9 +594,12 @@ button {
left: 0;
height: 2px;
background: var(--accent);
width: 0%;
/* ⚑ bolt: use GPU-accelerated transform instead of layout-inducing width */
width: 100%;
transform-origin: left;
transform: scaleX(0);
z-index: 10001;
transition: width 0.1s linear;
transition: transform 0.1s linear;
}

/* === Gallery === */
Expand Down