Replies: 3 comments 4 replies
-
Doesn't seem like there is any proper way to do it? A workaround that I can think of is to put in custom script into the <header fixed>
<div id="header_banner">
// Banner here
</div>
</header>
// custom script and style to put in the header file
<script>
document.addEventListener('scroll', () => {
const banner = document.getElementById('header_banner');
if (window.scrollY > 100) {
banner.style.maxHeight = 0;
} else {
banner.style.removeProperty("max-height");
}
})
</script>
<style>
#header_banner {
/* set the max-height according to how much content is in the banner */
max-height: 200px;
overflow: hidden;
transition: max-height 0.6s ease-out;
}
</style> There may be other better ways to do it but this is what I can come up with for now. |
Beta Was this translation helpful? Give feedback.
-
My current approach to adding a banner seems to have another problem, as mentioned in this comment. See reposense/RepoSense#1559 (review) Should that be considered a bug or is my current way of adding a banner the problem? |
Beta Was this translation helpful? Give feedback.
-
Another use case (from https://se-education.org/) |
Beta Was this translation helpful? Give feedback.
-
Context:
Currently, I've put this yellow banner inside the
<header fixed>
element, together with the top<navbar>
element. Which means they both stay at the top of the page all the time.Ideally, I would like the banner part to be not-fixed, which means it should scroll with the page (reason: to prevent it taking screen space permanently). But I want the
navbar
element to stay fixed at the top of the page.Is there a way to achieve that? If yes, what's the best way?
@MarkBind/active-devs
Beta Was this translation helpful? Give feedback.
All reactions