Why won't this image change? Below is the relevant HTML, CSS, and jQuery code.
HTML
<nav id="desktop-nav">
<div class="logo">
<a href="#"></a>
</div>
<div> ... </div>
...
CSS
nav#desktop-nav .logo a {
display: block;
width: 50px;
height: 50px;
background-image: url("../path/to/image-logo-white.png");
background-size: 50px 50px;
}
jQuery
$(document).ready(function(){
$(window).scroll(function(){
if($(window).scrollTop() > $(window).height()) {
$("nav#desktop-nav .logo a").attr("src", "../path/to/image-logo.png");
}
})
NOTE: I have tested this function, and it does work (I changed the color of text):
$("#desktop-nav #main-nav .main-nav-center .main-nav-list li a").css({"color":"black"});
Can you help me figure out what I am doing wrong?