I'm really new to Javascript and I've been spending forever trying to fix this issue. My code works just how I want it to on my [Codepen]
$(window).on("scroll", function() {
if ($(window).scrollTop() > 10) {
$(".topnav").addClass("active");
$(".mustang").addClass("active");
$(".sally").addClass("active");
} else {
$(".topnav").removeClass("active");
$(".mustang").removeClass("active");
$(".sally").removeClass("active");
}
});
function myFunction() {
var x = document.getElementById("myTopnav");
if (x.className === "topnav") {
x.className += " responsive";
} else {
x.className = "topnav";
}
}
However it won't work on [my website]. The big issue is that the navbar on top will not change color on my website, but on my Codepen it changes perfectly.
I'm almost certain it's an issue with my Javascript and I'd really appreciate it if someone could help me out. Thank you.