0
Hi people see if you can help me, I need a function using jquery or a simpler method, which change my logo when scrolling the mouse scroll, at the moment I have the following function, which just changes the color of the navbar:
<script type="text/javascript">
$(window).on('scroll', function(){
if($(window).scrollTop()){
$('nav').addClass('color');
$('logo').attr('src', '/img/logo-dark.png');
}else{
$('nav').removeClass('color');
}
})
</script>
Just below I have the html with the logo fixed on that navbar:
<nav>
<div id="logo" class="logo">
<a href="#"><img src="img/logo-branco.png"></a>
</div>
In this case, every time you scroll down the same scroll in navbar color, change the logo to the logo that is on the site src="img/logo-dark.png"
If any answer has served you, mark it as accepted. See how and why in https://pt.meta.stackoverflow.com/questions/1078/como-e-por-que-aceitar-uma-resposta/1079#1079
– user60252