Highlighting current link within a navigation list in rails

March 28, 2011

It's very common to want to highlight the current link within a navigation list for the current action being performed. If you are using Ajax, then this is easy, handle the onclick event to highlight the current link. "this.addClassName('youarehere');this.siblings().each(function(s){ s.removeClassName('youarehere');});", :class = '', :id = 'home' % "this.addClassName('youarehere');this.siblings().each(function(s){ s.removeClassName('youarehere');});", :class = '', :id = 'news' % Make sure you have a CSS class called youarehere. The following CSS is just an example. ... Read more

© 2017 | Follow on Twitter