I'm not very experienced with JavaScript, so please bear with me.
I'm attempting to create a fixed header that transitions to 50% opacity when scrolled down and returns to full opacity (opacity: 1.0) when scrolled back to the top. Here is my current progress:
$(document).ready(function() {
var header = $('#header');
var start = $(header).offset().top;
$.event.add(window, "scroll", function() {
if($(window).scrollTop();
$('#header').fadeTo(600, 0.5);
$(header).css('position',((position)>start) ? 'fixed' : 'static');
$(header).css('top',((position)>start) ? '0px' : '0px');
});