I'm having a styling issue with my website. So I have 3 different sections for my navbar. First being for socials, second having my company logo, and third having web-page links.
As you can see from the first image, they're all supposed to be white and have the hover effect (this all works completely fine for the home page).
For the other three pages however I have a change of design and would like to make all my links in the navigation bar black, in doing so I have used the 'invert' feature in my css. However, when I try to change the filter for all images and links, they're split into "social-icon", "logo-white" for the company logo, and "nav-link" for the web page links. The issue I am having with it is for some reason when I click to the change the page, it only effects the 'invert' on the first image of each part (so the first social media icon, the company logo and the first web page link), as well as this, it completely takes the hover effect away from the images and links that have changed too. I've been messing around with 'foreach' statements but can't seem to get it to work at all.
//loads work page
function workPage() {
document.getElementById("landing-page").style.display = "none";
document.getElementById("work-page").style.display = "block";
document.getElementById("about-page").style.display = "none";
document.getElementById("contact-page").style.display = "none";
document.getElementById("social-icon").style.filter = "invert(100%)";
document.getElementById("logo-white").style.filter = "invert(100%)";
document.getElementById("nav-link").style.filter = "invert(100%)";
}
#social-icon {
filter: invert(0%);
transition: filter .3s;
}
#social-icon:hover {
filter: invert(50%);
}
<!-- navigation bar -->
<div class="nav-bar">
<!-- socials -->
<div class="socials-container">
<!-- instagram -->
<div class="social-icon-container">
<a href="#">
<img src="images/instaLogo.png" alt="Instagram Link" class="social-icon" id="social-icon">
</a>
</div>
<!-- tiktok -->
<div class="social-icon-container">
<a href="#">
<img src="images/tiktokLogo.png" alt="Tiktok Link" class="social-icon" id="social-icon">
</a>
</div>
<!-- youtube -->
<div class="social-icon-container">
<a href="#">
<img src="images/youtubeLogo.png" alt="YouTube Link" class="social-icon" id="social-icon">
</a>
</div>
</div>
<!-- company logo -->
<div class="company-logo-container">
<div class="logo-container">
<a href="home.html">
<img src="images/logo.png" alt="white company logo" id="logo-white">
</a>
</div>
</div>
<!-- page links -->
<div class="page-links-container">
<a href="#landing-page" id="nav-link" onclick="landingPage()">Home</a>
<a href="#work-page" id="nav-link" onclick="workPage()">Work</a>
<a href="#about-page" id="nav-link" onclick="aboutPage()">About</a>
<a href="#contact-page" id="nav-link" onclick="contactPage()">Contact</a>
</div>
</div>
Home page with normal filter and hover effect:
Work page with changed filter and broken hover effect: