So At the moment, I have:
<a href"..." class="site-nav__link" id="site-nav__link-id">Home</a> <a href"..." class="site-nav__link" id="site-nav__link-id">All Collections</a> <a href"..." class="site-nav__link" id="site-nav__link-id">Blog</a> <a href"..." class="site-nav__link" id="site-nav__link-id">About us</a> <!-- and more elements that are href elements. --> function testFunction() { var elem = document.getElementById("AccessibleNav"); var linkId = document.getElementById("site-nav__link-id"); if (document.body.scrollTop > 100 || document.documentElement.scrollTop > 100) { elem.style.backgroundColor = "#333"; elem.style.width = "105%"; elem.style.textAlign = "center"; elem.style.left = "0px"; elem.style.fontColor = "white"; elem.style.position = "fixed"; linkId.style.color = "white"; } else { elem.style.backgroundColor = ""; elem.style.width = ""; elem.style.textAlign = ""; elem.style.left = ""; elem.style.color = "white"; elem.style.position = "static"; } } In this code I'm pretty much saying when I scroll 100px It does the top part if it's not scrolled it does the bottom part.
So when I do linkId.style.color = "white" or <br> document.getElementById("site-nav__link-id").style.color = 'white'" it only makes 1 element the first one or the one that says home into white. And I need all of them to turn white. Does anyone have a solution to this? For me to be able to either target the class and change all of the element's style or target the id and change all of the element's style.