I am looking to create a page layout similar to the following design:
<nav>...</nav> <!-- nav bar with fixed height -->
<main> <!-- carousel container taking up most of the height -->
<div>...</div> <!-- section A filling entire carousel container height -->
<div>...</div> <!-- section B filling entire carousel container height -->
</main>
<footer>...</footer> <!-- footer with fixed height -->
To achieve this layout, I have implemented the code snippet provided. The layout functions correctly on desktop browsers, where the navbar and footer remain visible while the scrollable sections snap as the user scrolls.
However, when viewed on mobile browsers, the static address bar takes away from the full-screen experience. Typically, users tend to scroll down slightly to hide the address bar before interacting with the content. In this specific layout, the carousel pages transition instead of allowing the address bar to be scrolled away first. The address bar only hides when scrolling outside of the carousel area onto the navbar or footer.
I am wondering if it is possible to modify this behavior so that users are able to scroll away the address bar initially for a fullscreen experience, before being able to scroll through the carousel pages. Is this feasible in current browser capabilities?
The CSS code snippet controls the carousel behavior:
.carousel {
display: inline-flex;
overflow-x: scroll;
scroll-snap-type: x mandatory;
scroll-behavior: smooth;
background: blue;
}
.carousel-vertical {
display: flex;
flex-direction: column;
overflow-y: scroll;
scroll-snap-type: y mandatory;
}
.carousel-item {
box-sizing: content-box;
display: flex;
flex: none;
scroll-snap-align: start;
}
<script src="https://cdn.tailwindcss.com"></script>
<nav class="h-[4rem] bg-red-300">Nav</nav>
<div class="carousel carousel-vertical bg-red-500 h-[calc(100dvh_-_8rem)]">
<div class="h-[calc(100dvh_-_8rem)] bg-blue-300 carousel-item">a</div>
<div class="h-[calc(100dvh_-_8rem)] bg-blue-500 carousel-item">b</div>
</div>
<footer class="h-[4rem] bg-red-700">
Footer
</footer>
I would like to determine if achieving the desired scroll behavior is currently possible in modern browsers. If it can be done, could you provide a working example? If not, please offer a credible source supporting this limitation. (E.g., any rejected feature requests related to this function?)