mvc sitemapprovider hash fragment

后端 未结 2 1641
心在旅途
心在旅途 2020-12-21 01:08

I\'m using sitemapprovider to implement breadcrumbs in my MVC4 application. I need to add an hash fragment val



        
2条回答
  •  醉话见心
    2020-12-21 01:51

    Thanks! In the meantime, I found a workaround,but it's specific to my situation:

    switch (window.location.hash.toString()) {
                case '#Network-tab':
                    //alert('Network-navTab');
                    $("#Network-navTab").addClass("active");
                    $("#Network-tab").addClass("active in");
                    break;
                case '#Network_Company-tab':
                    //alert('Network_Company-navTab');
                    $("#Network_Company-navTab").addClass("active");
                    $("#Network_Company-tab").addClass("active in");
                    break;
                case '#Company_Skin-tab':
                    //alert('Company_Skin-navTab');
                    $("#Company_Skin-navTab").addClass("active");
                    $("#Company_Skin-tab").addClass("active in");
                    break;
                case '#Skin_Player-tab':
                    //alert('Skin_Player-navTab');
                    $("#Skin_Player-navTab").addClass("active");
                    $("#Skin_Player-tab").addClass("active in");
                        break;
                default:
                    $("#Network-navTab").addClass("active");
                    $("#Network-tab").addClass("active in");
                    break;
    
            }
    

    I've put the hash corresponding to the menu link in the default case of the switch,so in this case I don't have to check for the hash the first time I load the view...in the other cases, I set the hash in the route during the postback... but thanks again! I'll bookmark your answer for when I won't be able to do this :)

提交回复
热议问题