Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Drupal menu block

Posted on 2010-09-12
9
Medium Priority
?
520 Views
Last Modified: 2012-05-10
Hello Experts,

I was wondering, is there a way to add  a different class to the each link in the drupal menu block? I can add a class to the block using the block class module, but I don't know how to add a class to each link of the menu block.
Attached goes a pic of the structure of my meny block using firebug.
I will really appreciate your help.

Thanks in advance,

Winter

PS. Also, do you know how can I rename that .leaf class?
Picture-9.png
0
Comment
Question by:glepiza
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 17

Expert Comment

by:Thomas4019
ID: 33658303
Could probably be done using the advice here, http://drupal.org/node/201948.

What exactly are you trying to achieve?
0
 

Author Comment

by:glepiza
ID: 33658342
Hi Thomas!, thanks for your answer, I am going to take a look at it.

I am trying to add an sprite image to the block menu to show active, hover and and visited state. That is why I need at least to have the class of each link


Thanks :)
0
 
LVL 17

Expert Comment

by:Thomas4019
ID: 33658377
Hmm, I don't see why you couldn't just use the classes you've already been given. The A tags have the "active" class if they are the page currently open. You can use pseudo classes for the rest, http://www.w3schools.com/css/css_pseudo_classes.asp.

The you could apply a CSS property like the attached. If it doesn't make sense refer to these,
http://www.w3schools.com/Css/pr_text_text-indent.asp
http://www.w3schools.com/css/pr_background-image.asp


Sounds like you want something similar to this, http://drupal.org/project/menu_icons. The module probably could be hacked a bit to do what you want.
.menu a {
  text-ident: 30px;
  background-image:url('regular.gif');
}

.menu a.active {
  text-ident: 30px;
  background-image:url('active.gif');
}

.menu a:hover {
  text-ident: 30px;
  background-image:url('hover.gif');
}

.menu a:visited {
  text-ident: 30px;
  background-image:url('visited.gif');
}

Open in new window

0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:glepiza
ID: 33658552
Thanks Thomas,

I think I am going to use your advice. I wanted to add specific class to each link to be able to use one sprite image that contains the three link states instead of using different images for each link state. To use an sprite image I need to use a different background position to each link class.  But I have a feeling that is going to take me longer than I expect to add those classes unless I use some javascript, what do you think?

Thanks again!

0
 
LVL 17

Accepted Solution

by:
Thomas4019 earned 2000 total points
ID: 33658575
Yeah. sprites cannot be easily embedded unless you add HTML using a Drupal theme function.
0
 

Author Closing Comment

by:glepiza
ID: 33658591
Thanks Thomas!
0
 

Author Comment

by:glepiza
ID: 33658596
Could you please let me know what documentation should I read to add theme functions? I may want to give it a try later on, not today though :) Thanks.
0
 
LVL 17

Expert Comment

by:Thomas4019
ID: 33659108
0
 

Author Comment

by:glepiza
ID: 33659255
Thanks so much Thomas, I would give you more points if I could. Thanks very much.

Winter
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for those that are having major problems with users upload files such as pictures to their profile. The solution is simple and has to do with correcting the directory paths. With some experimenting and testing i got it fixed. Note…
This script checks a path to see if a folder exists. If the folder does exist you will get output "The folder has previously been created. No action taken" If not it will create the folder. Then adds one user modify permission to the folder. It …
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question