How I call a function when I scrool for a specific section of the page?

I’m just not sure how to call a function when I scroll to a specific section on my page.

EXAMPLE:
I want to change the color of a text when I scroll to the article section.
or… I want to hide a button when I scroll on the last sections of the page.
or… I want to change the background of the page when I scroll to the footer.

I tried something like:

function func() {
var paragraph = document.getElementById('p');
paragraph.style.color = 'red';
};
<section>
<p id="p" onload="func()">
Test
</p>
</section>