Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

Top Nav Menu items different colors

  Asked By: Sampat Bellubbli         Date: Jan 02, 2009      Category: Sharepoint      Views: 1988
 

Is there any way to have the top nav menu buttons to be different
colors?
My client wants to color code their portal sections..
I know that the top nav menu is one control and this may be difficult.

Tagged:            

 

2 Answers Found

 
Answer #1       Answered By: Irving Hurley          Answered On: Jan 02, 2009       

The current control  isn't set up to allow that. You would have to write
your own custom control. The question is, what metadata would you key
off of for the colors? Since the NavBar is dynamic you would have to
build in some algorithm for determining which color  to make the tab.

 
Answer #2       Answered By: Trevor Davis          Answered On: Jan 02, 2009       

There doesn't appear to be an ID for each tab, but if you want to use a
little client-side JavaScript to manipulate the tabs, the following
example will change the background color  of a Team Site top-link bar tab
red with white text:

<script type="text/javascript">
try
{
var topNav = document.getElementById("onetIdTopNavBarContainer");
var links = topNav.getElementsByTagName("A");

for (var i=0; i < links.length; i++)
{
var link = links[i];
if (link.parentNode.nodeName == "TD")
{
if (link.innerText == "Child Site")
{
link.style.cssText = "background-image: none; background-color:
red; color: white;";
}
}
}
}
catch(e)
{
alert(e.Message);
}
</script>

 
Didn't find what you were looking for? Find more on Top Nav Menu items different colors Or get search suggestion and latest updates.


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].