$(document).ready(function() {
$(window).scroll(function() {
var scroll = $(window).scrollTop();
if (scroll > 200) {
$(".nav-bg").css({
"background": "#fff",
"box-shadow": "0px 0px 4px #ddd"
});
$(".nav-link").addClass("link-color");
$(".nav-item a").hover(function() {
$(this).css("color", "#150945 !important");
})
} else {
$(".nav-bg").css({
"background": "transparent",
"box-shadow": "none"
});
}
})
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<li class="nav-item">
<a href="#contact" class="nav-link pi">THOUGHTS</a>
</li>
<li class="nav-item">
<a href="#contact" class="nav-link pi">CONTACT</a>
</li>
Expected Output: When hovering over the link, the color should change. It seems that adding properties other than color works fine, but when specific colors are added it does not function as expected.