$(window).scroll(function () {
if ($(this).scrollTop() > 0) {
$('#header ul').animate({ width: 811, marginTop: 0 }, 200);
$('#inicio-btn, #sobre-nos-btn, #sistemas-btn, #noticias-btn, #contato-btn, #usuario-btn').animate({ marginTop: 30 }, 200);
$('#logo').animate({ width: 120, marginTop: 18 }, 200);
} else {
$('#header ul').animate({ width: 931, marginTop: 90 }, 200);
$('#inicio-btn, #sobre-nos-btn, #sistemas-btn, #noticias-btn, #contato-btn, #usuario-btn').animate({ marginTop: 37 }, 200);
$('#logo').animate({ width: 240, marginTop: 0 }, 200);
}
});
When the condition is false, that is, when it returns to the top of the page, the code takes a while to run. It's as if JQ was there thinking about what to do ... I've tried a thousand things and nothing solves this problem.