The second function in my example went missing :P $('tr').hover(function(){ $(this).addClass(CLASS_WITH_BACKGROUND_COLOR); }, function(){ $(this).removeClass(CLASS_WITH_BACKGROUND_COLOR); });
On Apr 17, 4:04 pm, mkmanning <michaell...@gmail.com> wrote: > András, you can use CSS as MorningZ said: > > tr:hover td {/*some color*/} > > If you're td's don't have a background color, you can put it directly > on the tr > > tr:hover {/*some color*/} > > Note that IE6 doesn't support the :hover pseudo-class on elements > other than anchors, to if IE6 support is needed, then you'll have to > resort to JavaScript. > > This jQuery will work: > > $('tr').hover(function(){ > $(this).addClass(CLASS_WITH_BACKGROUND_COLOR);} > > $(this).removeClass(CLASS_WITH_BACKGROUND_COLOR); > ); > > You could also just use .css() and set the color that way, but keeping > it in a CSS class has some advantages. Again, if your td's have a > background color using a color on the TR won't help. You could add/ > remove classes to the td's in the row, but the problem is still best > solved with CSS: > > tr.CLASS_WITH_BACKGROUND_COLOR td{ > background-color: some_color !important; > > } > > Depending upon where your CSS class is in the hierarchy and the > specificity of other classes or inline styles (hopefully there are > none), you may need an !important on the class, or some other change > to ensure it's specificity is higher. > > HTH :) > > On Apr 17, 1:23 pm, waseem sabjee <waseemsab...@gmail.com> wrote: > > > here's the solution. > > the jquery code is > > > $("#myid").hover(function() { > > $("#myelement").animate({ backgroundColor:"#666" ), 1000 );}, > > > function() { > > $("#myelement").animate({ backgroundColor:"#FFF" ), 1000 );} > > > ); > > > just make sure the you have a unique ID > > > On Fri, Apr 17, 2009 at 8:41 PM, András Csányi <sayusi.a...@gmail.com>wrote: > > > > Hi all! > > > > I'm developing an php and jQuery based grid (something like this: > > >http://www.phpgrid.com/grid/) for my Thesises and I want to coloring > > > the table row if the mouse over the row. You know, this is the minimal > > > visual feature what is following the users eyes... > > > I tried with css (<tr class="css_class with :hover">) and jQuery > > > (every tr tag has id and .addClasses and .removeClasses) but I > > > could'nt. I'm not an css and jquery magician. :$ > > > > So, I need some hints how can I do this with jquery. Or you can give > > > some tutorial or examples. > > > > Appreciate yours help! > > > > András > > > > -- > > > - - > > > -- Csanyi Andras --http://sayusi.hu--Sayusi Ando > > > -- "Bízzál Istenben és tartsd szárazon a puskaport!".-- Cromwell