Skip to content

Commit

Permalink
bg image pos
Browse files Browse the repository at this point in the history
  • Loading branch information
encse committed Nov 16, 2024
1 parent 5c8b0bf commit 2137332
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@

.header-image img {
object-fit: cover;
object-position: 0 0;
}

.header-title {
Expand Down Expand Up @@ -355,20 +354,6 @@ <h2 id="problem-name"></h2>
topNav.appendChild(span);
}
}


document.addEventListener("DOMContentLoaded", function () {
let container = document.querySelector(".header-image");
let movingImage = document.querySelector(".header-image img");

window.addEventListener("scroll", function () {
let scrollAmount = window.scrollY;
let imageSize = movingImage.clientWidth / movingImage.naturalWidth * movingImage.naturalHeight;
let newTop = Math.min(imageSize - container.clientHeight, scrollAmount)
movingImage.style.objectPosition = `0 -${newTop}px`;
});
});

</script>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-P8Y1BWSSF3"></script>
<script>
Expand Down

0 comments on commit 2137332

Please sign in to comment.