Adrian Thaws

'); $(function(){ $(window).scroll(function(){ if (!isScrolledIntoView("#header")) { $("#header-placeholder").addClass("sticky"); $("#subHeader").addClass("sticky"); } else { $("#header-placeholder").removeClass("sticky"); $("#subHeader").removeClass("sticky"); } }); }); function isScrolledIntoView(elem) { var docViewTop = $(window).scrollTop(); var docViewBottom = docViewTop + $(window).height(); var elemTop = $(elem).offset().top; var elemBottom = elemTop + $(elem).height(); return ((( elemTop >= docViewTop) && (elemTop <= docViewBottom)) || ((elemBottom >= docViewTop) && (elemBottom <= docViewBottom))); }