Add class to header on scroll

Very handy if we want to make changes on a header when you want to manage the header after scroll. I.e. to make it fixed or on an absolute position.

jQuery(document).ready(function($) {
    // AWK - add class "shrink" to .header on scroll
    $(window).scroll(function() {
        if ($(document).scrollTop() > 150) {
        $('#awk-header').addClass('shrink')
        } else {
        $('#awk-header').removeClass('shrink')
    }
    })
    
})
Scroll to Top