im pretty new to coding html/css and I cant figure out how to disable scroll by default (when opening the page) and activate it again once the user clicked on the icon. The icon itself causes the page to scroll down to the "introduction" div.
A nice bonus would be, that if the user scrolls up again and nothing but the start div is showing, it should disable again until clicked on the icon.
HTML/CSS only preferred, since I havent learned JavaScript yet and dont want use something I dont understand. If its not possible without, then no problem.
I already tried like 90% of the solutions that I found online, but I guess either the embedding of the javascript didnt work or the code itself doesnt work with my html/css code.
Heres my html code snippet:
</head>
<body>
<header>
<h1 class="blur-in">Welcome, take your time.</h1><br>
<div class="activateScroll">
<a href="#fixedNavbar"><i class="fa-solid fa-chevron-down fa-2x slide-in"></i </a>
</div>
</header>
<main>
<div id="fixedNavbar">
<nav>
<ul>
<li><a href="">home</a></li>
<li><a href="">skills & work</a></li>
<li><a href="">about me</a></li>
<li><a href="">contact</a></li>
</ul>
</nav>
</div>
<section>
<div class="introduction">
</div>
</section>
</main>
<footer>
</footer>
</body>
</html>
** Relevant CSS Code (everthing that could help) **
* {
padding: 0;
margin: 0;
box-sizing: border-box;
font-family: 'Libre Franklin';
}
html, body {
width: 100%;
height: 100vh;
scroll-behavior: smooth;
}
.start {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
}
#fixedNavbar {
position: sticky;
top: 0;
width: 100%;
z-index: 100;
}
This may or may not be possible with some hacky CSS, but this is 100% the job of JavaScript.
Check out the CodePen here and let me know if you have any questions: https://codepen.io/vince1444/pen/vYbLLEv