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. |
3 replies
|
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? |
1 reply
|
Another use case (from https://se-education.org/) |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Uh oh!
There was an error while loading. Please reload this page.
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
navbarelement 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
All reactions