Skip to content

Commit f3eb588

Browse files
committed
Fix search bar position — measure actual header height with JS instead of hardcoding
1 parent 3561714 commit f3eb588

2 files changed

Lines changed: 10 additions & 2 deletions

File tree

src/css/style.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5529,7 +5529,7 @@ body:has(.tools-hub-page) {
55295529
.tools-mobile-search {
55305530
display: block;
55315531
position: fixed;
5532-
top: 61px;
5532+
top: 0;
55335533
left: 0;
55345534
right: 0;
55355535
z-index: 30;

src/tools/index.njk

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,15 @@ permalink: /tools/
107107

108108
<script>
109109
(function() {
110-
var isMobile = window.innerWidth <= 768;
110+
var isMobile = window.innerWidth <= 900;
111+
112+
// Position search bar below the actual header
113+
var searchBar = document.getElementById('tools-mobile-search');
114+
var siteHeader = document.getElementById('site-header');
115+
if (searchBar && siteHeader && isMobile) {
116+
var headerH = siteHeader.offsetHeight;
117+
searchBar.style.top = headerH + 'px';
118+
}
111119
112120
// Collapsible categories on mobile
113121
document.querySelectorAll('.category-header').forEach(function(header) {

0 commit comments

Comments
 (0)