Skip to content

Commit

Permalink
back to background image as picture was doing bad flickering
Browse files Browse the repository at this point in the history
  • Loading branch information
tsubik committed Nov 21, 2024
1 parent 8bf0d39 commit 6ef9630
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 34 deletions.
12 changes: 3 additions & 9 deletions components/ui/static-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,10 @@ class StaticHeader extends React.Component {
return (
<div
className={`c-static-header ${customClasses}`}
style={{
backgroundImage: `image-set(url(${background.replace('.jpg', '.webp')}) type('image/webp'), url(${background}) type('image/jpeg'))`,
}}
>
<div className="c-static-background">
<picture>
{/* make sure webp image is also available */}
<source type="image/webp" srcSet={background.replace('.jpg', '.webp')} />
<source type="image/jpeg" srcSet={background} />
<img src={background} alt="" />
</picture>
</div>

{tabs ? (
<div className="wrapper">
<div className="container">
Expand Down
51 changes: 26 additions & 25 deletions css/components/page/_static-section.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,37 +10,38 @@
height: 80vh;
max-height: 720px;
}
}

.c-static-background {
display: block;
overflow: hidden;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
box-sizing: border-box;
margin: 0;

img {
.c-static-background {
display: block;
overflow: hidden;
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
box-sizing: border-box;
padding: 0;
border: none;
margin: auto;
display: block;
width: 0;
height: 0;
min-width: 100%;
max-width: 100%;
min-height: 100%;
max-height: 100%;
object-fit: cover;
object-position: center;
margin: 0;

img {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
box-sizing: border-box;
padding: 0;
border: none;
margin: auto;
display: block;
width: 0;
height: 0;
min-width: 100%;
max-width: 100%;
min-height: 100%;
max-height: 100%;
object-fit: cover;
object-position: center;
}
}
}

0 comments on commit 6ef9630

Please sign in to comment.