Author: Noah Olatoye
This tutorial will target a navbar element on the page and change both background color and text color when the user scroll 100px from top of the page.
- The
window.scroll
Function to capture the scroll event whenever user scrolls. - The
scrollNavbar
function is used to declare what happen whenever user scrolls
if
statement to check the condition whether the user scrolls up to 100px- Changed the background color of the navbar upon scroll
forloop
to add and remove color on links