Skip to content

Commit f1faef3

Browse files
committed
Home hero-image performance improvements
1 parent 31f3a85 commit f1faef3

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

src/components/home/Top.vue

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div class="container">
44
<img
55
class="hero-image"
6-
src="../../assets/_img/shieldmaiden-cropped.webp"
6+
src="../../assets/_img/shieldmaiden.webp"
77
alt="Shieldmaiden Hero Image"
88
fetchpriority="high"
99
/>
@@ -29,7 +29,6 @@
2929
</div>
3030
</router-link>
3131
</div>
32-
<q-resize-observer @resize="setSize" />
3332
</div>
3433
</div>
3534
</template>
@@ -42,7 +41,6 @@ export default {
4241
},
4342
data() {
4443
return {
45-
width: 0,
4644
tools: [
4745
{
4846
title: "Combat Tracker",
@@ -77,16 +75,6 @@ export default {
7775
],
7876
};
7977
},
80-
computed: {
81-
isMobile() {
82-
return this.width < 768;
83-
},
84-
},
85-
methods: {
86-
setSize(size) {
87-
this.width = size.width;
88-
},
89-
},
9078
};
9179
</script>
9280

@@ -97,12 +85,12 @@ export default {
9785
.container {
9886
max-width: 1280px;
9987
padding: 22px 20px 50px 20px;
88+
position: relative;
10089
10190
.hero-image {
102-
transform: scaleX(-1);
10391
object-fit: cover;
104-
object-position: top 0 left -30px;
105-
height: 250px;
92+
object-position: top -30px right -30px;
93+
aspect-ratio: 16 / 9;
10694
width: 100%;
10795
margin-bottom: 22px;
10896
}
@@ -185,12 +173,15 @@ export default {
185173
.top {
186174
.container {
187175
padding: 95px 20px 77px 20px;
188-
background-image: url("../../assets/_img/shieldmaiden.webp");
189-
background-repeat: no-repeat;
190-
background-position: top 50px right -120px;
191176
192177
.hero-image {
193-
display: none;
178+
position: absolute;
179+
top: 50px;
180+
right: -120px;
181+
object-position: top right;
182+
width: 512px;
183+
aspect-ratio: 512 / 705;
184+
margin: 0;
194185
}
195186
.buttons {
196187
flex-direction: row;
@@ -220,7 +211,12 @@ export default {
220211
.top {
221212
.container {
222213
padding: 145px 30px 77px 30px;
223-
background-position: top 55px right -20px;
214+
215+
.hero-image {
216+
top: 55px;
217+
right: 0;
218+
aspect-ratio: 512 / 655;
219+
}
224220
225221
h2 {
226222
max-width: 500px;
@@ -244,7 +240,11 @@ export default {
244240
@media only screen and (min-width: $xl-breakpoint) {
245241
.top {
246242
.container {
247-
background-position: top 10px right 85px;
243+
.hero-image {
244+
top: 10px;
245+
right: 85px;
246+
aspect-ratio: 512 / 670;
247+
}
248248
249249
h2 {
250250
max-width: 600px;

0 commit comments

Comments
 (0)