751 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
CyberShot says

I am trying to figure out how to get the background of the hovered anchor tag to turn the span.number background red. Right now when I hover, it turns them all red. I only want the one that is hovered on red. So if you hover on a category, it will turn the category color red as well as the background of the number to the right red.

http://jsfiddle.net/fPj52/3/
34 posts
  • Has been part of the Envato Community for over 3 years
  • Has sold $40,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Located in Europe
+2 more
synesthete says

Hi, if You want change only background color use css only:

ul li:hover span.number {
background-color:red;
}

or

ul:hover span.number {
background-color:red;
}
751 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
CyberShot says

yes, that will work but it will not work if you hover over the span.category. That is why I am trying to use jquery

313 posts
  • Sells items exclusively on Envato Market
  • Has been a beta tester for an Envato feature
  • Has sold $10,000+ on Envato Market
  • Has referred 10+ members
+2 more
squaredWeb says

Here you go: http://jsfiddle.net/fPj52/10/

I moved the “category” class from the span to the li and since i have no clue if the span is used for something more later i just left it in.

4264 posts Community Mod Building awesome stuff for your mobile devices!
  • Has referred 100+ members
  • Has sold $125,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 1+ items on Envato Market
+14 more
Enabled Volunteer moderator says

Here you go: http://jsfiddle.net/fPj52/10/ I moved the “category” class from the span to the li and since i have no clue if the span is used for something more later i just left it in.

+1. Would’ve done the same!

no-thumbnail
caliperconstruction Recent Posts Threads Started
1 post
  • Has been part of the Envato Community for over 2 years
  • Has collected 1+ items on Envato Market
caliperconstruction says

Thank you. Very interesting. Just out of curiosity, why bother moving the category class form the span to the li? is there really a difference?

751 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 1+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
CyberShot says

Oops, that last post is from me. Forgot I was logged into another account

313 posts
  • Sells items exclusively on Envato Market
  • Has been a beta tester for an Envato feature
  • Has sold $10,000+ on Envato Market
  • Has referred 10+ members
+2 more
squaredWeb says

Basically its just the shortest and most efficient way, at least to my knowledge, to achieve this effect. If you use ”$(this)” on the span with the “category” class you would have to go the extra mile with something like this: http://jsfiddle.net/fPj52/25/

Plus if you move the class to the li element you can remove the span and save some html markup.

by
by
by
by
by
by