Skip to content

Commit

Permalink
Merge pull request #574 from danskernesdigitalebibliotek/DDFFORM-517-…
Browse files Browse the repository at this point in the history
…man-kan-zoome-for-langt-ud-pa-mobil

Make sure header doesnt break out zoom on mobile. DDFFORM-517
  • Loading branch information
rasben authored Apr 8, 2024
2 parents 25f5deb + 74797b0 commit 69003ca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/stories/Blocks/header/header-sticky.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,20 @@ window.addEventListener("DOMContentLoaded", () => {
lastScrollY = scrollY > 0 ? scrollY : 0;

// Control header direction class.
const headerContainerSelector = ".header";

if (scrollDirection === "down") {
const headerHeight = document.querySelector("header").offsetHeight;
const headerHeight = document.querySelector(
headerContainerSelector
).offsetHeight;
const headerDownTopPosition = headerHeight + headerDownTopPositionOffset;
document.querySelector(
"header"
headerContainerSelector
).style.top = `-${headerDownTopPosition}px`;
} else {
document.querySelector("header").style.top = `${headerYStartPosition}px`;
document.querySelector(
headerContainerSelector
).style.top = `${headerYStartPosition}px`;
}
};

Expand Down
4 changes: 4 additions & 0 deletions src/styles/scss/shared.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
cursor: pointer;
}

.overflow-hidden {
overflow: hidden;
}

// When class is used on a block element it will show a loading ellipsis animation.
.text-loading:after {
overflow: hidden;
Expand Down

0 comments on commit 69003ca

Please sign in to comment.