I have a fixed position header on my website that has an alpha transparency when its at the top of the page. When the user scrolls past the top of the page, it animates to a solid color. However, when the user scrolls back to the top of the page I want the color to go back to alpha transparency. Unfortunately from what I've read JQuery color animations don't support RGBA values. I have the color changing when the user scrolls down, however I can't get it to change to a color when its back at the top of the page.
<script type="text/javascript">
$(window).scroll(function() {
$("#header").css("position", "fixed");
if ($(window).scrollTop() > 0) {
$("header").animate({backgroundColor:'#2b2b2b'}, 'slow');
}
if ($(window).scrollTop() <= 0) {
$("header").animate({backgroundColor: '#000000'}, 'slow');
}
});
</script>
Any ideas on how to do this?