kempachik,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
body {
height: 2000px;
margin: 0;
}
#intro {
height: 100px;
width: 100vw;
background-color: #008000;
}
#header {
height: 100px;
width: 100vw;
background-color: #FF00FF;
}
#header.fixed {
position: fixed;
top: 0;
}
</style>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script>
$(function() {
var header = $("#header"),
introH = $("#intro").innerHeight(),
scrollOffset = 0;
$(window).on("scroll", function() {
scrollOffset = $(this).scrollTop();
if (scrollOffset >= introH) {
header.addClass("fixed");
} else {
header.removeClass("fixed");
}
});
});
</script>
</head>
<body>
<div id="intro"></div>
<div id="header"></div>
</body>
</html>