I want to use the same navigation everywhere (mysite, teamsites ..) So I'm fetching the (managed navigation) global navigation by csom in the masterpage. The global navigation is only going to show one level.
The problem is that when I'm in a subsubsite the navigation do not set any of the rootnode as active. So I can not use css to style the element. I need to set the right "node" as active programatically, where ever you are down the structure
-root -sitecoll (internalinfo) -subsite (organisation) -sitecoll (social)
What I want is to set the active node, below you can see some example of some urls.
http://dev.site.com/InternalInfo/.../../../SitePages/home.aspx (set InternalInfo as active) http://dev.site.com/InternalInfo/Organization/SitePages/home.aspx (set organization as active) http://dev.site.com/Social/../../../../SitePages/home.aspx (set social as active)
As you can see
Could I do something like this?
var currentLocation = window.location; var pathArray = window.location.pathname.split( '/' ); if(pathArray == "Organisazion") setAsActive("Orgainzation"); if(pathArray == "InternalInfo") setAsActive("InternalInfo");
If you got a better way please give an example.