Skip to content

Commit 4356f42

Browse files
Toggle page header visibility based on banner
When rendering a game, hide the page H1 text via visibility (keeps layout space) if a banner image is present and initialize the banner display. If no banner is available, hide the entire page header (display: none) to avoid an empty header area. Also remove the global CSS rule that previously hid H1s in browse/games.html so the JS can control header visibility instead.
1 parent 773ed3a commit 4356f42

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

gh-pages-template/assets/js/game_detail.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,20 @@ function renderGame(data) {
4141
pageHeader.appendChild(imgDesc);
4242
}
4343

44+
// Hide the h1 (but keep space) when there's a banner image
45+
if (pageHeaderH1) {
46+
pageHeaderH1.style.visibility = "hidden";
47+
}
48+
4449
// Initialize the image display
4550
initGameBanner();
4651
}
52+
} else {
53+
// No banner image, hide the entire page header
54+
const pageHeader = document.querySelector("header.header-section");
55+
if (pageHeader) {
56+
pageHeader.style.display = "none";
57+
}
4758
}
4859

4960
// Cover

gh-pages-template/browse/games.html

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99
- href: https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200
1010
---
1111

12-
<style>
13-
.page-heading h1 {
14-
display: none;
15-
}
16-
</style>
17-
1812
<script>
1913
window.GAMEDB_CONFIG = {
2014
base_path: "{{ site.baseurl }}"

0 commit comments

Comments
 (0)