Add changes to HTML sections using JavaScript condition

Hello, I have a one section website that shows sections (about, services, …) when scrolling down (hiding the previous section).
How can I use JavaScript code to add CSS changes when each section is shown (changes like: show/hide a certain logo, change color of active text of the section in main menu, changing color of navigation menu, …?
What I mean : if this section is selected (using the menu or the nav bar) / scrolled to (mouse scrolling) , then do the CSS changes
Any help?

When you label your html objects as id and class you can get these through javascript.

Once you have the object in javascript, you can change it’s style property when a certain condition is triggered (e.g. onmouseover).

That’s three things you can look up in MDN documentation for instructions and examples:

  • get element by id or get element by class
  • change element style
  • conditional triggers (onmouseover, onkeyup, etc…)