Skip to content

Commit 63363f7

Browse files
committed
Additional prep for more fancy background loading
1 parent 2ee3811 commit 63363f7

2 files changed

Lines changed: 35 additions & 2 deletions

File tree

landing.php

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,12 +253,37 @@ function drawBranchInfo(array $release): void
253253
</div>
254254
</div>
255255

256-
<div style="background: #202127">
257-
<div class="landing-section">
256+
<div style="background: #202127; position: relative" >
257+
<?php foreach ($heroCards as $heroCard) { ?>
258+
<div class="hero-bg" id="<?= safe($heroCard->id . '-cover') ?>"></div>
259+
<?php } ?>
260+
261+
<div class="landing-section" style="position: relative; z-index: 1">
258262
<div role="list" class="vgrid"><?= buildNavCards($heroCards) ?></div>
259263
</div>
260264
</div>
261265

266+
<script type="text/javascript">
267+
(() => {
268+
let heroIds = <?= json_encode(array_map(fn(NavCardItem $card) => $card->id, $heroCards), flags: JSON_HEX_QUOT | JSON_HEX_QUOT) ?>;
269+
heroIds.forEach(heroId => {
270+
const cover = document.querySelector('#' + heroId + '-cover');
271+
if (!cover) console.error('Unable to find cover ' + heroId);
272+
273+
const card = document.querySelector('#' + heroId);
274+
if (!card) console.error('Unable to find card ' + heroId);
275+
276+
card.addEventListener('mouseenter', () => {
277+
cover.style.opacity = 1;
278+
});
279+
280+
card.addEventListener('mouseleave', () => {
281+
cover.style.opacity = 0;
282+
});
283+
});
284+
})();
285+
</script>
286+
262287
<div class="landing-section">
263288
<div id="releases" >
264289
<div class="landing-lrv">

styles/landing.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,3 +406,11 @@
406406
.landing-card-btn:focus-visible {
407407
outline: 4px solid #818cf8;
408408
}
409+
410+
.hero-bg {
411+
transition: all 0.5s ease-in-out;
412+
position: absolute;
413+
inset: 0;
414+
opacity: 0;
415+
}
416+

0 commit comments

Comments
 (0)