Team:Calgary Entrepreneurial/JS/header.js
From 2013.igem.org
$(document).ready(function(){
//only activates if JS is active: changes z-index of the maincontent box to //go over the blackheader instead of the default value (2) $('#maincontent').css('z-index', '3');
});
//slower, but necessary to have all images already in place prior to calculating fixadent $(window).load(function(){ //initialize values for headers so that the whiteheader can appear on sufficient scroll var fixadent = $("#maincontent"), pos = fixadent.offset(), white = $('#whiteheader'), black = $('#blackheader');
$(window).scroll(function(){
//fades in the white header when the white portion hits the top if(window.pageYOffset > pos.top){ white.fadeIn(250,function(){ white.css('display', 'block'); }); black.fadeOut(250,function(){ black.css('display', 'none'); }); } //fade out otherwise else{ white.fadeOut(250,function(){ white.css('display', 'none'); }); black.fadeIn(250,function(){ black.css('display', 'block'); }); }
});
});