Skip to content

Commit 6384e0b

Browse files
committed
Implemented a genuinely shameful reflowing solution for the home page
1 parent c6d3c1e commit 6384e0b

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,8 @@ <h2 id="entry-1-23-10-2024-">Entry 1 (23-10-2024)</h2>
364364
<script src="scripts/main/vines.js"></script>
365365
<script src="scripts/main/sidebarfit.js"></script>
366366
<script src="/scripts/main/header.js"></script>
367+
<script src="/scripts/main/posswap.js"></script>
368+
367369

368370
</body>
369371
<div class="copyrightDiv" style="position: fixed; bottom: 0; background: linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.6)), url(img/bg/dirt.png); background-size: 32px; image-rendering: pixelated; width: 100%; left: 0; text-align: center; z-index: 100; font-family: 'Minecraft Regular'; font-size: 13pt; color: rgba(255, 255, 255, 0.9); height: 25px;">

scripts/main/posswap.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
function swapElementsIfNarrow() {
2+
// wyndchyme was here. I'm sorry. This should be flex. I'm really sorry.
3+
const didYouKnow = document.querySelector('.didYouKnow');
4+
const featuredVideo = document.querySelector('.featuredVideo');
5+
6+
if (window.innerWidth < 650 && didYouKnow && featuredVideo) {
7+
const parent = didYouKnow.parentElement;
8+
if (didYouKnow.nextElementSibling === featuredVideo) {
9+
parent.insertBefore(featuredVideo, didYouKnow);
10+
}
11+
} else {
12+
const parent = featuredVideo.parentElement;
13+
if (featuredVideo.nextElementSibling === didYouKnow) {
14+
parent.insertBefore(didYouKnow, featuredVideo);
15+
}
16+
}
17+
}
18+
19+
window.addEventListener('load', swapElementsIfNarrow);
20+
window.addEventListener('resize', swapElementsIfNarrow);

style.css

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -373,12 +373,18 @@ body {
373373
}
374374
}
375375

376-
@media (max-width: 550px) {
376+
@media (max-width: 650px) {
377377
.didYouKnow {
378-
display: none;
378+
width: 100% !important;
379+
position: relative;
380+
height: fit-content;
381+
margin-top: -10px !important;
382+
margin-bottom: 10px;
379383
}
380384
.featuredVideo {
381385
width: 100% !important;
386+
max-height: 300px;
387+
height: 75vw;
382388
}
383389
}
384390

0 commit comments

Comments
 (0)