function stickyHeader()

in _src/_scripts/main.js [37:60]


function stickyHeader() {
    // get height of first two headers
    var scrollHeight = 80;
    var self = this;
    if($( window ).width() > 750) {

        $(window).scroll(function() {
            // get current scroll position
            var scrollTop = $(this).scrollTop();

            // if current position > scrollHeight
            if (scrollTop > scrollHeight) {
                // make fixed and change background color
                $('.site-header').addClass('sticky').animate({top: "0"}, 300);

            } else if (scrollTop == 0) {
                // unfix and go back to default color
                $('.site-header').css('top','-80px').removeClass('sticky');
            }

        });

    }
}