Good day. The essence of the problem. There is a code when resizing the browser window as well as when scrolling some css properties change. The problem is that when reducing the width of the browser from 768 or more to a size less than 767 and simultaneously scrolling, the lower part of the code is not executed
else{ $(".wrapper_nav").css('position','relative'); $(".logo_dark").css('display','block'); $(".logo").css('display','none'); }; Here is the whole code
$(window).resize(function(){ var width = document.documentElement.clientWidth; if (width > 767) { $(".wrapper_nav").css('position','fixed'); $(".list_mobnav").css('display','none'); $('.wrapper_nav').removeClass("wrapper_nav-white"); $(window).scroll(function(){ if ($(window).scrollTop() > 20 ){ $(".wrapper_nav").addClass("wrapper_nav-white").fadeIn('fast'); $(".logo_dark").css('display','block'); $(".logo").css('display','none'); $(".parent_item-big").css('color','black'); } else { $(".wrapper_nav").removeClass("wrapper_nav-white").fadeIn('fast'); $(".logo_dark").css('display','none'); $(".logo").css('display','block'); $(".parent_item-big").css('color','white'); }; }).trigger('scroll'); }else{ $(".wrapper_nav").css('position','relative'); $(".logo_dark").css('display','block'); $(".logo").css('display','none'); }; }).trigger('resize');