row highlighting
I have inside a .erb file an HTML table which rows' classes are alternated using
<tr class="<%= cycle('even_line', 'odd_line') %>">
This gives me a good visual style, but it is not enough. I want to change the row class on event mouseover. Is there any rails helper that gives me this functionality? I'm searching through the API but can't find anything helpful. Ho开发者_StackOverflowpe you can help me. Thanks!
Well you're adding the color in CSS. So you can define in CSS that you want it to be an other color on mouse over.
.even_line { color: #FFF; }
.odd_line { color: #000; }
That's for your "normal" lines.
And for the mouse over :
.even_line:hover { color: #000; }
.odd_line:hover { color: #FFF; }
Note : it won't work on IE6 (on mouse over, the color will not change).
There's no built-in Rails helper that will do this. There are numerous CSS and JavaScript snippets that will do what you want. Tablecloth is a good one.
精彩评论