<!-- © https://javascript.ru/forum/dom-window/79465-kak-pri-skrollinge-aktivirovat-animaciyu-v-predelakh-odnogo-tolko-opredelennogo-bloka.html#post520035 -->
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style>.header,
.footer,
.parallax {
height: 1000px;
}
.header,
.footer {
background-color: pink;
}
*!*
.footer {
position: relative;
z-index: 1;
}
*/!*
.parallax {
background-color: beige;
}
span {
text-align: center;
font-size: 0px;
position: fixed;
top: 50%;
left: 0;
right: 0;
height: 2px;
line-height: 2px;
margin-top: -1px;
}</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$(function() {
var parallax = document.querySelector('.parallax');
$(window).scroll(function() {
var {top,bottom} = parallax.getBoundingClientRect();
var size = 0;
if(top < 0 && bottom > window.innerHeight) size = Math.round(-top / (parallax.scrollHeight - window.innerHeight) * 120);
if(bottom < window.innerHeight) size = 120;
$('span').css('font-size', `${size}px`);
});
})
</script>
</head>
<body>
<div class="header"></div>
<div class="parallax"><span>Parallax</span></div>
<div class="footer"></div>
</body>
</html>