Window height issue / Sidebar fixed

$('#home-content').height($(window).height());
$('.bottom_section').css({
    top:$(window).height()
});
$(window).scroll(function(){
    if($(window).height() < $(this).scrollTop()){
        $('.site-header').css({
            position:'fixed',
            top:0
        });
    }else{
        $('.site-header').css({
            position:'inherit'
        });
    }
});

 Sidebar fixed

jQuery(window).scroll(function(){
    
    var scroll_top = jQuery(this).scrollTop();
    var sidebar_top = jQuery('.right-side-part').offset().top;
    var bottom_position = jQuery(document).height() - jQuery(".site-footer").height() - jQuery("#secondary").height();

    if ( scroll_top > sidebar_top && scroll_top < bottom_position ) {
        $('#secondary').addClass('fixed')
    }else{
        $('#secondary').removeClass('fixed');
     }
});