Skip to content

Commit

Permalink
Scroll to top of modal on open
Browse files Browse the repository at this point in the history
  • Loading branch information
Vedal987 committed Jun 10, 2024
1 parent 00beee9 commit 70f1f54
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions frontend/www/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
body {
background-color: #111;
color: #fff;
overscroll-behavior: contain;
}

main {
Expand Down
4 changes: 4 additions & 0 deletions frontend/www/src/modules/modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ document.addEventListener("auxclick", (e) => {
/* Containers */
const $modalWrapper = document.getElementById("modal-wrapper")!;
const $modal = document.getElementById("modal-wrapper")!.getElementsByClassName("modal")[0]!;
const $modalInsideWrapper = $modal.getElementsByClassName("modal-inside-wrapper")[0]!;

/* Descriptors */
const $modalTitle = document.getElementById("modal-title")!;
Expand Down Expand Up @@ -109,6 +110,9 @@ export async function openModal(redeem: Redeem | null) {
$modalPrice.textContent = redeem.price.toString();
$modalImage.src = redeem.image;

// scroll to top of modal
$modalInsideWrapper.scrollTop = 0;

setTimeout(() => $modal.classList.add("active-modal"), 10);

hideProcessingModal();
Expand Down

0 comments on commit 70f1f54

Please sign in to comment.