[support] How to have current menu item highlighted when it's an image?

Stefan Borchert stefan at borchert.cc
Thu Dec 14 21:40:53 UTC 2006


Jody Cleveland schrieb:
> Hello,
>
> I've got a site here:
> http://beta.menashalibrary.org/teens/read
>
> That has a menu across the top. I'm looking for the best way to do this
> within drupal. To do the mouseovers, I'm using javascript. This changes
> the image you're mousing over, and the one below it with text. Is there
> a way to do this but still have drupal create the menu?
>
> Also, I'd like it so the active link is the same image as when you mouse
> over it. The only way I can think of to do this is to use sections and
> have a different section for each link. Is there a better way to do
> this?
>   
Hi.
Why not use pure CSS!?
Each link have its own id and an image containing all versions 
(non-highlighted, highlighted, active). You can than select the image 
part by changing the background position with css (#item1:hover {}; 
#item1:active {}).
The technique is called "image rollover". More details here [1] or at 
alistapart [2].

hth,

 Stefan

[1] http://wellstyled.com/css-nopreload-rollovers.html
[2] http://alistapart.com/articles/slidingdoors2/



More information about the support mailing list