I would like to do this using .animate instead of .css. When I change it to animate it gets glitchy and won't work
$(window).scroll(function() {
var scrollTop = $(window).scrollTop();
if (scrollTop != 0) {
$('#test_box').css({
"background-color": "red",
"height": '400px'
});
} else {
$('#test_box').css({
"background-color": "blue",
"height": "200px"
});
}
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div id="test_box" style="height: 200px; width: 200px; background-color: red;"></div>
jQuery-UIor other library to have acolor animateeffectjquery.animate-colors.js