Show active parent with matching submenu when page is loaded jQuery $(document).ready(function() { $(".nav li [href]").each(function() { if (this.href == window.location.href) { $(this).css("background", "red"); $(this).addClass("hover"); $(this).parent().find('ul.sub').css("left","0"); } }); }); more Total views: 898 times Posted on March 27, 2023April 8, 2023 by ayush