parallax, font size is bigger on mobile

This commit is contained in:
Lazy Hippopotamus
2023-06-15 09:36:52 -04:00
parent 64d643267c
commit 73b265997e
7 changed files with 264 additions and 44 deletions

View File

@@ -8,6 +8,9 @@ function clamp(min, val, max) {
return val;
}
var ua = window.navigator.userAgent;
var iOS = !!ua.match(/iPad/i) || !!ua.match(/iPhone/i); // THANKS, STACKOVERFLOW
function getNearestChildIndexTo(element, position) {
var nearest = undefined;
var nearestValue = Infinity;
@@ -70,6 +73,11 @@ const scrollchecks = () => {
}
}
});
if (iOS) {
Array.from(document.getElementsByClassName("parallax")).forEach((item, i) => {
item.style.backgroundPosition = "50% calc(" + (-item.getBoundingClientRect().top) + "px)";
});
}
};