Selecting lines

I have an HTML table inside my .erb file in which the string classes are interleaved with

<tr class="<%= cycle('even_line', 'odd_line') %>">

      

It gives me good visual style, but it is not enough. I want to change the class of the string on mouseover call. Is there any rails helper out there that gives me this functionality? I have searched through the API but cannot find anything useful. Hope you can help me. Thank!

+2


source to share


2 answers


Well, you add color to CSS. This way you can define in CSS that you want it to be a different mouse color.

.even_line { color: #FFF; }
.odd_line { color: #000; }

      

This is for your "normal" lines.



And for the mouse:

.even_line:hover { color: #000; }
.odd_line:hover { color: #FFF; }

      

Note: it will not work on IE6 (on mouse click, the color will not change).

+2


source


There is no built-in Rails helper to do this. There are tons of CSS and JavaScript snippets out there that will do what you want. The tablecloth is good.



0


source







All Articles