<style>
    .CurrentMenuColor{
        background-color: #007bff;
        color: #fff;
    }
</style>
<script> //左侧菜单定位 $(document).ready(function () { var pathname = window.location.pathname + window.location.search; $(".nav li a").each(function () { var href = $(this).attr("href"); if (pathname == href) { $(this).parents("ul").parent("li").addClass("menu-is-opening menu-open"); $(this).parent("li").addClass("CurrentMenuColor"); } }); }); </script>

_Layout.cshtml添加上面二项代码。

posted on 2024-04-12 08:50  风浪  阅读(3)  评论(0编辑  收藏  举报