🐛 fix(hero): fix background not scaled on iOS devices (#404)

iOS is using the full height & width of the body instead of the viewport to decide the size.
This causes problems with css `background-attachment: fixed`

see https://stackoverflow.com/questions/24154666/background-size-cover-not-working-on-ios/30469824#30469824
This commit is contained in:
2025-03-12 18:24:53 +01:00
committed by GitHub
parent 149e8a49dd
commit 94e6b92929
+5 -9
View File
@@ -8,14 +8,14 @@ const Hero = (props: { scrollTarget?: React.ForwardedRef<HTMLSelectElement> }) =
return ( return (
<Box <Box
sx={{ sx={{
postition: 'relative', position: 'relative',
minHeight: '100vh', minHeight: '100vh',
boxShadow: '0 0.25em 0.5em 0 rgba(0, 0, 0, 0.25)', boxShadow: '0 0.25em 0.5em 0 rgba(0, 0, 0, 0.25)',
backgroundImage: 'url("images/banner-blur.webp")', backgroundImage: 'url("images/banner-blur.webp")',
backgroundPosition: 'center center', backgroundPosition: 'center center',
backgroundAttachment: 'fixed', backgroundAttachment: { xs: 'scroll !important', md: 'fixed' },
backgroundSize: 'cover', backgroundSize: 'cover',
display: 'flex', display: 'flex',
@@ -42,19 +42,15 @@ const Hero = (props: { scrollTarget?: React.ForwardedRef<HTMLSelectElement> }) =
<h3>Robotics Engineer</h3> <h3>Robotics Engineer</h3>
*/} */}
<Typography <Typography
variant="h3" // sx={{ fontSize: '2.5em',margin: 0 }}
// sx={{ variant="h3">
// fontSize: '2.5em',
// margin: 0,
// }}
>
Robotics Engineer Robotics Engineer
</Typography> </Typography>
<Typography <Typography
color="text.secondary" color="text.secondary"
sx={{ sx={{
margin: '0.5em 0 0 0',
// margin: { xs: '0.5em 1em', md: '0.5em 0 0 0' }, // margin: { xs: '0.5em 1em', md: '0.5em 0 0 0' },
margin: '0.5em 0 0 0',
top: 0, top: 0,
}}> }}>
See some of my works below. Send a message to get in touch. See some of my works below. Send a message to get in touch.