Good to script:
$(document).ready(function(){
$("#banner").css({"height":$(window).height() + "px"});
var flag = false;
var scroll;
$(window).scroll(function(){
scroll = $(window).scrollTop();
if(scroll > 200){
if(!flag){
$("#logo").css({"margin-top": "-5px", "width": "50px","height":"50px"});
$("nav").css({"color": "#fff"});
$("ul").css({"color": "#000"});
flag = true;
}
}else{
if(flag){
$("#logo").css({ "width": "80px","height":"80px"});
$("ul").css({"color": "#000"});
$("header").css({"background-color": "#fff"});
flag = false;
}
}
});
});
html part of nav:
<header class="header">
<nav>
<ul>
<a href="http://www.keyquotes.es"><li>Youtube</li></a>
<a href="http://www.keyquotes.es"><li>Nosotros</li></a>
<a href="http://www.keyquotes.es"><li>Contacto</li></a>
</ul>
<img id="logo" src="pictures/logo.png">
<ul>
<a href="http://www.keyquotes.es"><li>Youtube</li></a>
<a href="http://www.keyquotes.es"><li>Nosotros</li></a>
<a href="http://www.keyquotes.es"><li>Contacto</li></a>
</ul>
</nav>
</header>
I wanted to understand what's missing or where I'm going wrong, my intention with this script is that when the page is in the top the ul stay black img:
andwhenscrollingthescrollitbecomeswhitelikeimg:
AndthenIaddedthistothescript:$("ul"). css ({"color": "# 000"}); and $ ("ul"). css ({"color": "#fff"}); , and what was the best option?