Skip to content

Commit f0023b7

Browse files
committed
Serve appropriately sized images based on device pixel ratio
1 parent c13326e commit f0023b7

33 files changed

+157
-77
lines changed

assets/styles/sections/home.scss

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
margin: 0;
1313
background-attachment: fixed;
1414
background-position: center;
15-
transform: scale(1.1);
15+
// Remove transform scale that causes blur
16+
// transform: scale(1.1);
1617
filter: saturate(1.1);
17-
// filter: blur(3px);
1818
background-size: cover;
1919
}
2020

@@ -32,7 +32,11 @@
3232
*/
3333
@supports (-webkit-touch-callout: none) {
3434
.background {
35+
// On iOS devices, use scroll instead of fixed
3536
background-attachment: scroll;
37+
// Ensure background covers the full area
38+
min-height: 100vh;
39+
background-size: cover;
3640
}
3741
}
3842

layouts/partials/sections/home.html

Lines changed: 33 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -75,32 +75,44 @@
7575

7676
<div class="container-fluid home" id="home">
7777
<style>
78-
/* 0 to 299 */
78+
/* Base styles for all screens */
7979
#homePageBackgroundImageDivStyled {
80-
background-image: url('{{ $tiny.RelPermalink }}');
80+
background-image: image-set(
81+
url('{{ $tiny.RelPermalink }}') 1x,
82+
url('{{ $small.RelPermalink }}') 2x,
83+
url('{{ $medium.RelPermalink }}') 3x);
8184
}
82-
/* 300 to X */
83-
@media (min-width: 500px) and (max-width: 800px) { /* or 301 if you want really the same as previously. */
84-
#homePageBackgroundImageDivStyled {
85-
background-image: url('{{ $small.RelPermalink }}');
86-
}
85+
86+
/* Medium screens */
87+
@media (min-width: 500px) and (max-width: 800px) {
88+
#homePageBackgroundImageDivStyled {
89+
background-image: image-set(
90+
url('{{ $small.RelPermalink }}') 1x,
91+
url('{{ $medium.RelPermalink }}') 2x,
92+
url('{{ $large.RelPermalink }}') 3x);
93+
}
8794
}
88-
@media (min-width: 801px) and (max-width: 1200px) { /* or 301 if you want really the same as previously. */
89-
#homePageBackgroundImageDivStyled {
90-
background-image: url('{{ $medium.RelPermalink }}');
91-
}
95+
96+
/* Larger screens */
97+
@media (min-width: 801px) and (max-width: 1200px) {
98+
#homePageBackgroundImageDivStyled {
99+
background-image: image-set(
100+
url('{{ $medium.RelPermalink }}') 1x,
101+
url('{{ $large.RelPermalink }}') 2x,
102+
url('{{ $src.RelPermalink }}') 3x);
103+
}
92104
}
93-
@media (min-width: 1201px) and (max-width: 1500px) { /* or 301 if you want really the same as previously. */
94-
#homePageBackgroundImageDivStyled {
95-
background-image: url('{{ $large.RelPermalink }}');
96-
}
105+
106+
/* Largest screens */
107+
@media (min-width: 1201px) {
108+
#homePageBackgroundImageDivStyled {
109+
background-image: image-set(
110+
url('{{ $large.RelPermalink }}') 1x,
111+
url('{{ $src.RelPermalink }}') 2x,
112+
url('{{ $src.RelPermalink }}') 3x);
113+
}
97114
}
98-
@media (min-width: 1501px) { /* or 301 if you want really the same as previously. */
99-
#homePageBackgroundImageDivStyled {
100-
background-image: url('{{ $src.RelPermalink }}');
101-
}
102-
}
103-
</style>
115+
</style>
104116
<span class="on-the-fly-behavior"></span>
105117
<div
106118
id="homePageBackgroundImageDivStyled"

public/404.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
88

9-
<link rel="stylesheet" href="/application.012fbad9bd15eea7a2faa7c286d22af5d7283632c9f6ee1be941f8e89cdf0c9b.css" integrity="sha256-AS&#43;62b0V7qei&#43;qfChtIq9dcoNjLJ9u4b6UH46JzfDJs=" />
9+
<link rel="stylesheet" href="/application.8ce90bbb69348f3eaaddd2b70d0853a45309ac41d5c6410b5771c44f4da32383.css" integrity="sha256-jOkLu2k0jz6q3dK3DQhTpFMJrEHVxkELV3HET02jI4M=" />
1010

1111

1212

public/application.186287df1dc97e02c3031b9bacaab277ab94f36f88136d401f46d8665a8f1a8f.css

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/application.8ce90bbb69348f3eaaddd2b70d0853a45309ac41d5c6410b5771c44f4da32383.css

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/application.94acdcbd274655e211e41c0e76a4d5e389a0a32dd6e5d0d6389380cee169e108.css

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/application.a056b6bec550f55d8b6285cde24049f91b44a1e4a8b32573d94a3f251a6b21b5.css

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/application.css.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/application.df46cf174d95d253ac7d44cb1f154bbf09cea129cba6de6f6207990fdc30c374.css

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/categories/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
77
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
88

9-
<link rel="stylesheet" href="/application.012fbad9bd15eea7a2faa7c286d22af5d7283632c9f6ee1be941f8e89cdf0c9b.css" integrity="sha256-AS&#43;62b0V7qei&#43;qfChtIq9dcoNjLJ9u4b6UH46JzfDJs=" />
9+
<link rel="stylesheet" href="/application.8ce90bbb69348f3eaaddd2b70d0853a45309ac41d5c6410b5771c44f4da32383.css" integrity="sha256-jOkLu2k0jz6q3dK3DQhTpFMJrEHVxkELV3HET02jI4M=" />
1010

1111

1212

0 commit comments

Comments
 (0)