• MVC中导航菜单,选中项的高亮问题。。


    先上图:            

    这个菜单是放在母板页的。比如当前选中的是异常业务监控。如果页面刷新了。就会变成第一张图。。选择其他的选项也会,因为页面会刷新嘛。。

    怎么处理这个问题了?

    答案是记录当前页面的url.

    有两种解决思路。前台与后台。。

    本文只说前台:

    上代码:

     function daohang() {
    
                var curr_location = location.href.toLocaleLowerCase();
    
    
                //遍历所有的a标签
                $("#test_ul a").each(function () {
    
                    //看当前的a标签的href在当前location中存不存在
                    var curr_a = $(this).attr("href").toLocaleLowerCase();
    
                    if (curr_location.indexOf(curr_a) != -1 && curr_a != "") {
                        //从当前location标签匹配到了当前a
                       //此处控制选中项的样式
    
                    }
                });
            }
    
     
  • 相关阅读:
    Friends ZOJ
    2^x mod n = 1 HDU
    Paint the Grid Reloaded ZOJ
    Treap 模板
    bzoj进度条
    。。。
    bzoj
    。。。
    bzoj
    题解continue
  • 原文地址:https://www.cnblogs.com/gaocong/p/4748115.html
Copyright © 2020-2023  润新知