Build a menu (li.selected)


#1

Hello,

when I try to create a menu I found the following limitation:
the event li.selected does not work
and, I am not being able to show an image when the menu option is
selected

in my CSS exists the following code:
.menu li.selected {

background: transparent url(/images/menu_selected.gif) 100% 1px
no-repeat;

}

in file: …\layouts\application.rhtml
exists the following code:

  • <%= link_to_unless_current "home", :controller => "home" %>
  • <%= link_to_unless_current "Resources", :controller => "resources", :action => "list" %>

Anyone can tell me how can I do this?
and tell me links source code samples of menus in rails?

thank You very much in advance


#2

there is no such thing as an ‘event’ li.selected. all you have done
there is define a class ‘selected’ for an li element within an
element with the ‘menu’ class

you will need to add the class attribute to the li element yourself.

per your css/html example:

  • ...
  • ...

#3

Chris H. wrote:

there is no such thing as an ‘event’ li.selected. all you have done
there is define a class ‘selected’ for an li element within an
element with the ‘menu’ class

you will need to add the class attribute to the li element yourself.

per your css/html example:

  • ...
  • ...

sorry,

What I’m trying to do is:

when the menu option is “not selected” it has a background image
and
when the menu option is “selected”(chosen by the user) it has another
background image

so, the class can not be fixed by “li”

Can You help me?
thank You very much