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: <div id="menu"> <ul> <li><%= link_to_unless_current "home", :controller => "home" %></li> <li><%= link_to_unless_current "Resources", :controller => "resources", :action => "list" %></li> </ul> 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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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: <div class="menu"> <ul> <li class="selected"> ... </li> ... </ul> </div> On 7/30/07, Paulo Matos <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > 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: > <div id="menu"> > <ul> > <li><%= link_to_unless_current "home", :controller => "home" %></li> > <li><%= link_to_unless_current "Resources", :controller => > "resources", :action => "list" %></li> > </ul> > > 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 > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Chris Hall 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: > > <div class="menu"> > <ul> > <li class="selected"> ... </li> > ... > </ul> > </div>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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---